docs.unity3d.com
    Show / Hide Table of Contents

    Class SelectionGroup

    A component to group a number of GameObjects under a common name.

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    SelectionGroup
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StartCoroutine_Auto(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, Boolean)
    Component.GetComponentInParent(Type)
    UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.DestroyObject(Object, Single)
    Object.DestroyObject(Object)
    Object.FindSceneObjectsOfType(Type)
    Object.FindObjectsOfTypeIncludingAssets(Type)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsSortMode)
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    UnityEngine.Object.FindFirstObjectByType<T>()
    UnityEngine.Object.FindAnyObjectByType<T>()
    UnityEngine.Object.FindFirstObjectByType<T>(UnityEngine.FindObjectsInactive)
    UnityEngine.Object.FindAnyObjectByType<T>(UnityEngine.FindObjectsInactive)
    Object.FindObjectsOfTypeAll(Type)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    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
    ICollection<T>.Count

    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
    IList<T>.Item[Int32]

    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 null.

    Implements
    ICollection<T>.Add(T)

    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
    ICollection<T>.Clear()

    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

    true if obj was found in the SelectionGroup; otherwise, false.

    Implements
    ICollection<T>.Contains(T)

    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
    ICollection<T>.CopyTo(T[], Int32)

    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
    IEnumerable<T>.GetEnumerator()

    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 obj within the SelectionGroup if found; otherwise, -.

    Implements
    IList<T>.IndexOf(T)

    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
    IList<T>.Insert(Int32, T)

    IsAutoFilled()

    Gets whether the group is automatically filled

    Declaration
    public bool IsAutoFilled()
    Returns
    Type Description
    Boolean

    OnAfterDeserialize()

    Declaration
    public void OnAfterDeserialize()
    Implements
    ISerializationCallbackReceiver.OnAfterDeserialize()

    OnBeforeSerialize()

    Declaration
    public void OnBeforeSerialize()
    Implements
    ISerializationCallbackReceiver.OnBeforeSerialize()

    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

    true if obj is successfully removed; otherwise, false.

    Implements
    ICollection<T>.Remove(T)

    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
    IList<T>.RemoveAt(Int32)

    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
    ICollection<T>.IsReadOnly

    IEnumerable.GetEnumerator()

    Declaration
    IEnumerator IEnumerable.GetEnumerator()
    Returns
    Type Description
    IEnumerator
    Implements
    IEnumerable.GetEnumerator()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023