public override void OnInspectorGUI() { base.OnInspectorGUI(); EditorGUI.BeginChangeCheck(); radius = EditorGUILayout.FloatField("Radius", cameraOrbit.radius); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(cameraOrbit, "Change Radius"); cameraOrbit.radius = radius; if (cameraOrbit.radiusMinArea > radius) { cameraOrbit.radiusMinArea = radius; } cameraOrbit.transform.localScale = Vector3.one * radius; cameraOrbit.AdjustCamera(); SceneView.RepaintAll(); } EditorGUI.BeginChangeCheck(); radiusMinArea = EditorGUILayout.Slider("Min Area Radius", cameraOrbit.radiusMinArea, 0, cameraOrbit.radius); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(cameraOrbit, "Change Min Area Radius"); cameraOrbit.radiusMinArea = radiusMinArea; SceneView.RepaintAll(); } if (camera != cameraOrbit.cam) { if (cameraOrbit.cam != null) { cameraOrbit.AdjustCamera(); camera = cameraOrbit.cam; } } if (targetObject != cameraOrbit.targetObject) { if (cameraOrbit.targetObject != null) { cameraOrbit.MoveToTarget(); targetObject = cameraOrbit.targetObject; } } }