logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityHierarchyUtils

    Helpers for navigating and querying the Unity scene hierarchy

    Inheritance
    object
    UnityHierarchyUtils
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Serenity.Global.Infrastructure.Utils
    Assembly: Serenity.UnityGlobal.Infrastructure.dll
    Syntax
    public static class UnityHierarchyUtils

    Methods

    FindAllInSceneWithTag(string)

    Returns every GameObject tagged tag under the active scene's roots (inactive included).

    Declaration
    public static List<GameObject> FindAllInSceneWithTag(string tag)
    Parameters
    Type Name Description
    string tag
    Returns
    Type Description
    List<GameObject>

    FindAllInSceneWithTag(Scene, string)

    Returns every GameObject tagged tag under the given scene's roots (inactive included).

    Declaration
    public static List<GameObject> FindAllInSceneWithTag(Scene scene, string tag)
    Parameters
    Type Name Description
    Scene scene
    string tag
    Returns
    Type Description
    List<GameObject>

    FindAllInScene<T>()

    Returns every component of type T under the active scene's roots (inactive included).

    Declaration
    public static T[] FindAllInScene<T>() where T : Component
    Returns
    Type Description
    T[]
    Type Parameters
    Name Description
    T

    FindAllInScene<T>(Scene)

    Returns every component of type T under the given scene's roots (inactive included).

    Declaration
    public static T[] FindAllInScene<T>(Scene scene) where T : Component
    Parameters
    Type Name Description
    Scene scene
    Returns
    Type Description
    T[]
    Type Parameters
    Name Description
    T

    FindChildrenWithTag(GameObject, string)

    Declaration
    public static GameObject FindChildrenWithTag(GameObject gO, string tag)
    Parameters
    Type Name Description
    GameObject gO
    string tag
    Returns
    Type Description
    GameObject

    FindChildrensWithTag(GameObject, string)

    Declaration
    public static List<GameObject> FindChildrensWithTag(GameObject gO, string tag)
    Parameters
    Type Name Description
    GameObject gO
    string tag
    Returns
    Type Description
    List<GameObject>

    FindComponent<T>()

    Declaration
    public static T FindComponent<T>() where T : MonoBehaviour
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    FindComponents<T>()

    Declaration
    public static T[] FindComponents<T>() where T : MonoBehaviour
    Returns
    Type Description
    T[]
    Type Parameters
    Name Description
    T

    FindInSceneWithTag(string)

    Finds the first GameObject tagged tag anywhere under the active scene's roots (inactive included), or null when none matches.

    Declaration
    public static GameObject FindInSceneWithTag(string tag)
    Parameters
    Type Name Description
    string tag
    Returns
    Type Description
    GameObject

    FindInSceneWithTag(Scene, string)

    Finds the first GameObject tagged tag anywhere under the given scene's roots (inactive included), or null when none matches.

    Declaration
    public static GameObject FindInSceneWithTag(Scene scene, string tag)
    Parameters
    Type Name Description
    Scene scene
    string tag
    Returns
    Type Description
    GameObject

    FindInScene<T>()

    Finds the first component of type T under the active scene's roots (inactive included), or null when none exists.

    Declaration
    public static T FindInScene<T>() where T : Component
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    FindInScene<T>(Scene)

    Finds the first component of type T under the given scene's roots (inactive included), or null when none exists.

    Declaration
    public static T FindInScene<T>(Scene scene) where T : Component
    Parameters
    Type Name Description
    Scene scene
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    FindUIChildrenWithTag(GameObject, string)

    Declaration
    public static GameObject FindUIChildrenWithTag(GameObject gO, string tag)
    Parameters
    Type Name Description
    GameObject gO
    string tag
    Returns
    Type Description
    GameObject

    FindUIChildrensWithTag(GameObject, string)

    Declaration
    public static List<GameObject> FindUIChildrensWithTag(GameObject gO, string tag)
    Parameters
    Type Name Description
    GameObject gO
    string tag
    Returns
    Type Description
    List<GameObject>

    GetAllRectTransformsInHierarchy(GameObject, bool)

    Declaration
    public static RectTransform[] GetAllRectTransformsInHierarchy(GameObject root, bool includeRoot = true)
    Parameters
    Type Name Description
    GameObject root
    bool includeRoot
    Returns
    Type Description
    RectTransform[]

    GetGameObjectPath(GameObject)

    Declaration
    public static string GetGameObjectPath(GameObject obj)
    Parameters
    Type Name Description
    GameObject obj
    Returns
    Type Description
    string

    GetInmediateChildren(GameObject)

    Declaration
    public static List<GameObject> GetInmediateChildren(GameObject obj)
    Parameters
    Type Name Description
    GameObject obj
    Returns
    Type Description
    List<GameObject>

    GetSceneRoots()

    Returns the root GameObjects of the active scene. A Unity scene has several roots, so this always returns an array; it is the starting point for the scene-scoped tag/component searches.

    Declaration
    public static GameObject[] GetSceneRoots()
    Returns
    Type Description
    GameObject[]

    GetSceneRoots(Scene)

    Returns the root GameObjects of the given scene, or an empty array when it is not loaded.

    Declaration
    public static GameObject[] GetSceneRoots(Scene scene)
    Parameters
    Type Name Description
    Scene scene
    Returns
    Type Description
    GameObject[]

    HasParentLayoutGroup(Transform)

    Declaration
    public static bool HasParentLayoutGroup(Transform t)
    Parameters
    Type Name Description
    Transform t
    Returns
    Type Description
    bool

    TryFindFirstImplementer<TInterface>(out TInterface)

    Declaration
    public static bool TryFindFirstImplementer<TInterface>(out TInterface instance)
    Parameters
    Type Name Description
    TInterface instance
    Returns
    Type Description
    bool
    Type Parameters
    Name Description
    TInterface
    In this article
    © 2026 Serenity. All Rights Reserved