Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Selection

Namespace: UnityEditor

Description

Access to the selection in the editor.

Static Variables

activeGameObjectReturns the active game object. (The one shown in the inspector).
activeInstanceIDReturns the instanceID of the actual object selection. Includes prefabs, non-modifyable objects.
activeObjectReturns the actual object selection. Includes prefabs, non-modifyable objects.
activeTransformReturns the active transform. (The one shown in the inspector).
assetGUIDsReturns the guids of the selected assets.
gameObjectsReturns the actual game object selection. Includes prefabs, non-modifyable objects.
instanceIDsThe actual unfiltered selection from the Scene returned as instance ids instead of objects.
objectsThe actual unfiltered selection from the Scene.
transformsReturns the top level selection, excluding prefabs.

Static Functions

ContainsReturns whether an object is contained in the current selection.
GetFilteredReturns the current selection filtered by type and mode.
GetTransformsAllows for fine grained control of the selection type using the SelectionMode bitmask.