private void AppendObjectsToSelection(List <GameObject> gameObjectsOverlappedBySelectionShape) { if (gameObjectsOverlappedBySelectionShape.Count != 0) { ObjectSelection objectSelection = ObjectSelection.Get(); ObjectSelectionUpdateMode _selectionUpdateMode = ObjectSelectionSettings.Get().SelectionUpdateMode; // Note: We only continue if the current object selection is not the same as the // collection of objects we are appending. If it is, we would be registering // an unnecessary Undo operation. if (!objectSelection.IsSameAs(gameObjectsOverlappedBySelectionShape)) { if (_selectionUpdateMode == ObjectSelectionUpdateMode.EntireHierarchy) { UndoEx.RecordForToolAction(objectSelection); objectSelection.AddEntireGameObjectHierarchyToSelection(gameObjectsOverlappedBySelectionShape); } else { UndoEx.RecordForToolAction(objectSelection); objectSelection.AddGameObjectCollectionToSelection(gameObjectsOverlappedBySelectionShape); } objectSelection.ObjectSelectionGizmos.OnObjectSelectionUpdatedUsingSelectionShape(); } } }