internal static void ChangeEditMode(EditMode.SceneViewEditMode mode, Bounds bounds, IToolModeOwner owner) { IToolModeOwner toolModeOwner = InternalEditorUtility.GetObjectFromInstanceID(EditMode.ownerID) as IToolModeOwner; EditMode.editMode = mode; EditMode.ownerID = ((mode == EditMode.SceneViewEditMode.None) ? 0 : owner.GetInstanceID()); if (EditMode.onEditModeEndDelegate != null && toolModeOwner is Editor) { EditMode.onEditModeEndDelegate(toolModeOwner as Editor); } if (EditMode.editModeEnded != null) { EditMode.editModeEnded(toolModeOwner); } if (EditMode.editMode != EditMode.SceneViewEditMode.None) { if (EditMode.onEditModeStartDelegate != null && owner is Editor) { EditMode.onEditModeStartDelegate(owner as Editor, EditMode.editMode); } if (EditMode.editModeStarted != null) { EditMode.editModeStarted(owner, EditMode.editMode); } } EditMode.EditModeChanged(bounds); InspectorWindow.RepaintAllInspectors(); }