/// <summary> /// This method is called to respond to an object selection changed message. /// </summary> private void RespondToMessage(ObjectSelectionChangedMessage message) { EditorObjectSelection objectSelection = EditorObjectSelection.Instance; // If no objects are selected, we will deactivate the active gizmo if (objectSelection.NumberOfSelectedObjects == 0) { _activeGizmo.gameObject.SetActive(false); } else // If the gizmos are not turned off, we may need to enable the active gizmo in the scene if (!_areGizmosTurnedOff) { // If there are objects selected, we will make sure the active gizmo is enabled in the scene. if (objectSelection.NumberOfSelectedObjects != 0 && !_activeGizmo.gameObject.activeSelf) { _activeGizmo.gameObject.SetActive(true); } // Make sure the position of the active gizmo is updated correctly EstablishActiveGizmoPosition(); // Now we must make sure that the active gizmo is oriented accordingly UpdateActiveGizmoRotation(); } }
/// <summary> /// Executes the action. /// </summary> public void Execute() { ObjectSelectionChangedMessage.SendToInterestedListeners(); EditorUndoRedoSystem.Instance.RegisterAction(this); }
/// <summary> /// Convenience function for sending an object selection changed message to /// all interested listeners. /// </summary> public static void SendToInterestedListeners() { var message = new ObjectSelectionChangedMessage(); MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message); }