using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; [CustomEditor(typeof(MainCamera))] public class MainCameraEditor : Editor { private void OnEnable() { MainCameraDebug.OnGUIHandlers -= OnGameViewGUI; MainCameraDebug.OnGUIHandlers += OnGameViewGUI; } private void OnDisable() { MainCameraDebug.OnGUIHandlers -= OnGameViewGUI; InspectorUtility.RepaintGameView(); } public override void OnInspectorGUI() { base.OnInspectorGUI(); } private void OnGameViewGUI() { MainCamera camera = target as MainCamera; if (camera == null) return; //Matrix4x4 oldMatrix = GUI.matrix; //Rect cameraRect = new Rect(0, 0, 500, 500); //GUI.matrix = Matrix4x4.Translate(cameraRect.min); ////GUILayout.Button("test"); //GUI.DrawTexture(new Rect(0, 0, 30, 30), Texture2D.whiteTexture); //GUI.matrix = oldMatrix; } }