From 02b44c07adfcf921da594120b4cd8fc18b982725 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 20 Sep 2021 00:42:33 +0800 Subject: +command buffer --- Assets/Scripts/Editor/MainCameraEditor.cs | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Assets/Scripts/Editor/MainCameraEditor.cs (limited to 'Assets/Scripts/Editor/MainCameraEditor.cs') 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; + } + +} -- cgit v1.1-26-g67d0