using System; using UnityEngine; using UnityEditor; using Framework.Services; namespace Framework.Support { /// Adds a margin to the bounds of a mesh [CustomEditor(typeof(CullingMarginExtender))] public class CullingMarginEditor : Editor { /// Renders the GUI for the inspector panel of this component public override void OnInspectorGUI() { DrawDefaultInspector(); if(GUILayout.Button("Add Culling Margin Permanently")) { var extender = target as CullingMarginExtender; if(target == null) { Debug.LogError("CullingMarginEditor's target is not a CullingMarginExtender"); return; } extender.ExtendCullingMargin(); GameObject.Destroy(extender); } } } } // namespace Framework.Support