Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Selection

Access to the selection in the editor.
Read time 1 minuteLast updated 5 days ago

Definition

  • Type: Class
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public sealed class Selection

Static Fields

Value

Description

selectionChangedDelegate callback triggered when currently active/selected item has changed.

Static Properties

Property

Description

activeContextReturns the current context object, as was set via SetActiveObjectWithContext.
activeGameObjectReturns the active game object. (The one shown in the inspector).
activeInstanceIDReturns the instanceID of the actual object selection. Includes Prefabs, non-modifiable objects.
activeObjectReturns the actual object selection. Includes Prefabs, non-modifiable objects.
activeTransformReturns the active transform. (The one shown in the inspector).
assetGUIDsReturns the guids of the selected assets.
countReturns the number of objects in the Selection.
gameObjectsReturns the actual game object selection. Includes Prefabs, non-modifiable objects.
instanceIDsThe actual unfiltered selection from the Scene returned as instance ids instead of Selection.objects.
objectsThe actual unfiltered selection from the Scene.
transformsReturns the top level selection, excluding Prefabs.

Static Methods

Method

Description

ContainsReturns whether an object is contained in the current selection.
GetFilteredReturns the current selection filtered by type and mode.
GetTransformsRetrieves the transforms of selected objects.
SetActiveObjectWithContextSelects an object with a context.