使用方法 脚本类前添加 [ExecuteAlways] 特性打开Game视图 该脚本自动执行 案例 using UnityEngine; [ExecuteAlways] //添加特性 Game视图下自动执行 public class OnGUILearn : MonoBehaviour { private void OnGUI() { Debug.Log("OnGUI"); GUI.Label(new Rect(0, 0, 50, 50), "文本"); } }