public override void OnInspectorGUI() { bool previewCreated = PreviewSection(); float pegOffset = renderer.PegOffset; float pegAngle = renderer.PegAngle; float pegSize = renderer.PegSize; float radius = renderer.Radius; base.OnInspectorGUI(); if (pegAngle != renderer.PegAngle || pegOffset != renderer.PegOffset || radius != renderer.Radius) { renderer.SetPegTransform(); } if (pegSize != renderer.PegSize) { renderer.SetPegSize(); } if (GUI.changed && !previewCreated) { DestroyPreviews(); } }
private void Awake() { renderer = target as DiskBase <T>; Undo.undoRedoPerformed += () => { DestroyPreviews(); renderer.SetPegTransform(); renderer.SetPegSize(); }; }