Tips4:把 Inspector面板转换为Debug模式

时间:2023-03-09 03:45:37
Tips4:把 Inspector面板转换为Debug模式

你知道 Inspector 的调试(debug)模式吗? 当debug模式打开后, Inspector将会把游戏物体所有的属性都显示出来,包括公有(public)和私有(private)变量. 例如,下图中显示的是一个游戏物体在普通(nomal)模式下的 Inspector:

 using UnityEngine;

 public class InspectorDebugModePlayer : MonoBehaviour
{
private float lastDeadTime = 0.3f; private Vector3 lastDeadPosition = new Vector3(4.0f,1.5f,100.0f); private Vector3 spawnPosition = new Vector3(-15.13f, 14.1f, 141.0f); public int health; public int score; public int ammo;
}

Tips4:把 Inspector面板转换为Debug模式

现在我们打开debug模式,,如下:

Tips4:把 Inspector面板转换为Debug模式

可以看出,现在我们可以看到脚本中的私有属性了.

返回的普通模式的设置步骤也是一样的:

Tips4:把 Inspector面板转换为Debug模式

使用inspector的调试模式能够让我们在调试过程中更加方便.