public static Transform RemoveController(UnitySensor sensor) { if (sensor.sensorTransform != null) { DestroyImmediate(sensor.sensorTransform.gameObject, true); } return(null); }
public static bool ControllerInspector(UnitySensor controller) { EditorGUILayout.BeginHorizontal(); controller.enabled = EditorGUILayout.ToggleLeft(controller.name, controller.enabled, GUILayout.MinWidth(80)); if (controller.enabled && Application.isPlaying) { EditorGUILayout.EnumPopup(controller.status); } EditorGUILayout.EndHorizontal(); return(controller.enabled); }
public static bool ControllerInspector(UnitySensor controller, Target target) { EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); bool enabled = EditorGUILayout.ToggleLeft(controller.name, controller.enabled, GUILayout.MinWidth(80)); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, enabled ? "Enabled " : "Disabled " + controller.name); controller.enabled = enabled; } if (Application.isPlaying && enabled) { EditorGUILayout.EnumPopup(controller.status); } EditorGUILayout.EndHorizontal(); return(enabled); }