using System.Collections.Generic; using UnityEngine.Rendering; namespace Unity.Toonshader { public static class UTSDebugPanel { static bool isPanelEnabled = false; static UTS_BSDFDebug uTS_BSDFData = UTS_BSDFDebug.None; static UTS_LightingDebug uTS_LightingData = UTS_LightingDebug.None; public static void OnEnable() { if (isPanelEnabled) return; // Create a list of widgets List widgetList = new List(); // Add a checkbox widget to the list of widgets widgetList.AddRange(new DebugUI.Widget[] { new DebugUI.EnumField { displayName = "BSDF debug mode", tooltip = "Select a bsdf debug mode", getter = () => (int)uTS_BSDFData, setter = value => uTS_BSDFData = (UTS_BSDFDebug)value, getIndex = () => (int)uTS_BSDFData, setIndex = value => uTS_BSDFData = (UTS_BSDFDebug)value, autoEnum = typeof(UTS_BSDFDebug), onValueChanged = BSDFDebugChanged }, new DebugUI.EnumField { displayName = "Lighting debug mode", tooltip = "Select a lighting debug mode", getter = () => (int)uTS_LightingData, setter = value => uTS_LightingData = (UTS_LightingDebug)value, getIndex = () => (int)uTS_LightingData, setIndex = value => uTS_LightingData = (UTS_LightingDebug)value, autoEnum = typeof(UTS_LightingDebug), onValueChanged = LightingDebugChanged }, }); // Create a new panel (tab) in the Rendering Debugger DebugUI.Panel panel = DebugManager.instance.GetPanel("UTS", createIfNull: true); // Add the widgets to the panel panel.children.Add(widgetList.ToArray()); isPanelEnabled = true; } private static void BSDFDebugChanged(DebugUI.Field field, int arg2) { } private static void LightingDebugChanged(DebugUI.Field field, int arg2) { } // Remove the custom panel if the GameObject is disabled public static void OnDisable() { DebugManager.instance.RemovePanel("UTS"); isPanelEnabled = false; } } }