diff options
Diffstat (limited to 'Assets/Scripts/Editor/MainCameraEditor.cs')
-rw-r--r-- | Assets/Scripts/Editor/MainCameraEditor.cs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Assets/Scripts/Editor/MainCameraEditor.cs b/Assets/Scripts/Editor/MainCameraEditor.cs new file mode 100644 index 00000000..437303a0 --- /dev/null +++ b/Assets/Scripts/Editor/MainCameraEditor.cs @@ -0,0 +1,45 @@ +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; + } + +} |