Class SelectionGroup
A component to group a number of GameObjects under a common name.
Inherited Members
Namespace: Unity.SelectionGroups
Syntax
[ExecuteAlways]
[AddComponentMenu("")]
public class SelectionGroup : MonoBehaviour, IList<GameObject>, ICollection<GameObject>, IEnumerable<GameObject>, IEnumerable, ISerializationCallbackReceiver
Properties
Color
Sets/gets the color of the SelectionGroup
Declaration
public Color Color { get; set; }
Property Value
Type | Description |
---|---|
Color |
Count
Gets the number of GameObjects in the SelectionGroup
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Implements
Item[Int32]
Sets or gets a member at the specified index. Setting a member does nothing if the SelectionGroup is automatically filled.
Declaration
public GameObject this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero based index of the GameObject to remove. |
Property Value
Type | Description |
---|---|
GameObject |
Implements
Members
Get the members of the SelectionGroup
Declaration
public IList<GameObject> Members { get; }
Property Value
Type | Description |
---|---|
IList<GameObject> |
Name
Sets/gets the name of the SelectionGroup
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
String |
Query
Sets/gets the query which will automatically include GameObjects from the hierarchy that match the query into the group.
Declaration
public string Query { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Add(GameObject)
Adds the specified GameObject to the SelectionGroup. Does nothing if the SelectionGroup is automatically filled.
Declaration
public void Add(GameObject obj)
Parameters
Type | Name | Description |
---|---|---|
GameObject | obj | The GameObject to be added. Cannot be |
Implements
AddRange(IEnumerable<GameObject>)
Adds the GameObjects in the specified collection to the end of the SelectionGroup if they are not already present. Does nothing if the SelectionGroup is automatically filled.
Declaration
public void AddRange(IEnumerable<GameObject> objects)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<GameObject> | objects | The collection of GameObjects to add. |
Clear()
Removes all GameObjects from the SelectionGroup.
Declaration
public void Clear()
Implements
Contains(GameObject)
Determines whether the specified GameObject is in the SelectionGroup.
Declaration
public bool Contains(GameObject obj)
Parameters
Type | Name | Description |
---|---|---|
GameObject | obj | The GameObject to locate in the SelectionGroup. |
Returns
Type | Description |
---|---|
Boolean |
|
Implements
CopyTo(GameObject[], Int32)
Copies the entire SelectionGroup to a compatible one-dimensional array, starting at the specified index of the target array.
Declaration
public void CopyTo(GameObject[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
GameObject[] | array | The one-dimensional Array that is the destination of the GameObjects copied from the SelectionGroup. The Array must have zero-based indexing. |
Int32 | arrayIndex | The zero-based index in array at which copying begins. |
Implements
EnableEditorTool(Int32, Boolean)
Declaration
public void EnableEditorTool(int toolID, bool toolEnabled)
Parameters
Type | Name | Description |
---|---|---|
Int32 | toolID | |
Boolean | toolEnabled |
Except(IEnumerable<GameObject>)
Removes all GameObjects from the SelectionGroup that are in the specified collection. Does nothing if the SelectionGroup is automatically filled.
Declaration
public void Except(IEnumerable<GameObject> objects)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<GameObject> | objects | The collection of GameObjects to be removed. |
GetEnumerator()
Declaration
public IEnumerator<GameObject> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<GameObject> |
Implements
GetLastQueryParseResult()
Declaration
public ParseResult GetLastQueryParseResult()
Returns
Type | Description |
---|---|
ParseResult |
IndexOf(GameObject)
Searches for the specified GameObject and returns the zero-based index of it.
Declaration
public int IndexOf(GameObject obj)
Parameters
Type | Name | Description |
---|---|---|
GameObject | obj | The GameObject to locate in the SelectionGroup. |
Returns
Type | Description |
---|---|
Int32 | The zero-based index of |
Implements
Insert(Int32, GameObject)
Inserts the specified GameObject into the SelectionGroup at the specified index. Does nothing if the SelectionGroup is automatically filled.
Declaration
public void Insert(int index, GameObject obj)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero-based index the GameObject should be inserted at. |
GameObject | obj | The GameObject to be inserted. |
Implements
IsAutoFilled()
Gets whether the group is automatically filled
Declaration
public bool IsAutoFilled()
Returns
Type | Description |
---|---|
Boolean |
OnAfterDeserialize()
Declaration
public void OnAfterDeserialize()
Implements
OnBeforeSerialize()
Declaration
public void OnBeforeSerialize()
Implements
Remove(GameObject)
Removes the specified GameObject from the SelectionGroup. Does nothing if the SelectionGroup is automatically filled.
Declaration
public bool Remove(GameObject obj)
Parameters
Type | Name | Description |
---|---|---|
GameObject | obj | The GameObject to be removed. |
Returns
Type | Description |
---|---|
Boolean |
|
Implements
RemoveAt(Int32)
Removes an GameObject at the specified index. Does nothing if the SelectionGroup is automatically filled.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The zero based index of the GameObject to remove. |
Implements
SetMembers(IEnumerable<GameObject>)
Clears and set the members of the SelectionGroup
Declaration
public void SetMembers(IEnumerable<GameObject> objects)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<GameObject> | objects | A enumerable collection of GameObjects to be added |
SetQuery(String)
Sets the query which will automatically include GameObjects from the hierarchy that match the query into the group. Returns early when the query is not valid (GoQL.ParseResult.OK).
Declaration
public void SetQuery(string q)
Parameters
Type | Name | Description |
---|---|---|
String | q | The query |
Explicit Interface Implementations
ICollection<GameObject>.IsReadOnly
Declaration
bool ICollection<GameObject>.IsReadOnly { get; }
Returns
Type | Description |
---|---|
Boolean |
Implements
IEnumerable.GetEnumerator()
Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator |