Version: 2019.1 (switch to 2018.3 or 2017.4)
LanguageEnglish
  • C#

Selection

class in UnityEditor

/

Implemented in:UnityEditor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Access to the selection in the editor.

Static Properties

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.
gameObjectsReturns the actual game object selection. Includes Prefabs, non-modifiable objects.
instanceIDsThe actual unfiltered selection from the Scene returned as instance ids instead of objects.
objectsThe actual unfiltered selection from the Scene.
selectionChangedDelegate callback triggered when currently active/selected item has changed.
transformsReturns the top level selection, excluding Prefabs.

Static Methods

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.
SetActiveObjectWithContextSelects an object with a context.

Did you find this page useful? Please give it a rating: