5 using RyleRadio.Components;
9 using UnityEditor.IMGUI.Controls;
18 public class RadioInsulatorEditor : Editor
23 private RadioInsulator insulator =
null;
26 private readonly BoxBoundsHandle outerBoundsHandle =
new();
28 private readonly BoxBoundsHandle innerBoundsHandle =
new();
34 private void OnEnable()
37 if (insulator ==
null)
38 insulator = (RadioInsulator)target;
40 if (insulator.
Data !=
null)
51 private void OnSceneGUI()
54 if (insulator ==
null)
55 insulator = (RadioInsulator)target;
58 Bounds outerBounds =
new(insulator.transform.position, insulator.
outerBoxSize);
59 Bounds innerBounds =
new(insulator.transform.position, insulator.
innerBoxSize);
62 outerBoundsHandle.center = outerBounds.center;
63 outerBoundsHandle.size = insulator.transform.localToWorldMatrix * outerBounds.size;
66 innerBoundsHandle.center = innerBounds.center;
67 innerBoundsHandle.size = insulator.transform.localToWorldMatrix * innerBounds.size;
70 EditorGUI.BeginChangeCheck();
71 outerBoundsHandle.DrawHandle();
72 if (EditorGUI.EndChangeCheck())
75 Undo.RecordObject(insulator,
"Change Outer Bounds");
76 insulator.outerBoxSize = insulator.transform.worldToLocalMatrix * outerBoundsHandle.size;
80 EditorGUI.BeginChangeCheck();
81 innerBoundsHandle.DrawHandle();
82 if (EditorGUI.EndChangeCheck())
85 Undo.RecordObject(insulator,
"Change Inner Bounds");
86 insulator.innerBoxSize = insulator.transform.worldToLocalMatrix * innerBoundsHandle.size;
93 public override void OnInspectorGUI()
95 DrawDefaultInspector();
RadioData Data
Read-only accessor for data.
An "insulator" for a RadioTrackWrapper - if a RadioOutput is inside the bounds of this object,...
Vector3 outerBoxSize
The size of the outer box of the insulator- outside of this box, insulation is 0- between this and th...
Vector3 innerBoxSize
The size of the inner box of the insulator- inside of this box, insulation is the highest.
Color GizmoColor
Alias for gizmoColor for safety.
Color GizmoColorSecondary
Alias for gizmoColorSecondary for safety.
Editor scripts for classes and attributes, notably excluding MultiselectAttribute.