Selection API. Allows selecting Entities, Assets etc.
Constructor
Gets the number of selected items
Gets enabled state of the selection methods.
Sets enabled state of the selection methods.
Gets the selection history
Gets the first selected item. Short for this.items[0].
Gets the selected items. This creates a new array every time it is called.
editor.selection.items.add(editor.entities.root);const selectedEntities = editor.selection.items; Copy
editor.selection.items.add(editor.entities.root);const selectedEntities = editor.selection.items;
Add item to selection
// add root entity to selectioneditor.selection.add(editor.entities.root); Copy
// add root entity to selectioneditor.selection.add(editor.entities.root);
Clears selection
editor.selection.clear(); Copy
editor.selection.clear();
Checks if item is in selection
const isRootSelected = editor.selection.has(editor.entities.root); Copy
const isRootSelected = editor.selection.has(editor.entities.root);
Remove item from selection
// remove root entity from selectioneditor.selection.remove(editor.entities.root); Copy
// remove root entity from selectioneditor.selection.remove(editor.entities.root);
Sets current selection
// select root entityeditor.selection.set([editor.entities.root]); Copy
// select root entityeditor.selection.set([editor.entities.root]);
Toggle item selection
// toggle root entity selectioneditor.selection.toggle(editor.entities.root); Copy
// toggle root entity selectioneditor.selection.toggle(editor.entities.root);
Selection API. Allows selecting Entities, Assets etc.