docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Class GameObjectUtils

    Utility methods for creating GameObjects. Allows systems to subscribe to GameObjectInstantiated.

    Inheritance
    object
    GameObjectUtils
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.XR.CoreUtils
    Assembly: solution.dll
    Syntax
    public static class GameObjectUtils

    Methods

    Name Description
    ClonePrefabWithHideFlags(GameObject, Transform)

    Clones the Prefab Game Object prefab and copies the hide flags of each Game Object in its hierarchy to the corresponding Game Object in the copy's hierarchy.

    CloneWithHideFlags(GameObject, Transform)

    Clones the Game Object original and copies the hide flags of each Game Object in its hierarchy to the corresponding Game Object in the copy's hierarchy.

    Create()

    Creates a new GameObject and returns it. This method also calls GameObjectInstantiated.

    Create(string)

    Creates a new GameObject and returns it. This method also calls GameObjectInstantiated.

    ExhaustiveComponentSearch<T>(GameObject)

    Searches for a component in a scene with a 3 step process, getting more comprehensive with each step At edit time will find all objects in the scene, even if they are disabled At play time, will be unable to find disabled objects that are not a child of desiredSource

    ExhaustiveTaggedComponentSearch<T>(GameObject, string)

    Searches for a component in a scene with a 3 step process, getting more comprehensive with each step At edit time will find all objects in the scene, even if they are disabled At play time, will be unable to find disabled objects that are not a child of desiredSource

    GetChildGameObjects(GameObject, List<GameObject>)

    Get the direct children GameObjects of this GameObject.

    GetComponentInActiveScene<T>()

    Retrieves the first component of the given type in the active scene

    GetComponentInScene<T>(Scene)

    Retrieves the first component of the given type in a scene

    GetComponentsInActiveScene<T>(List<T>, bool)

    Retrieves all components of the given type in the active scene

    GetComponentsInAllScenes<T>(List<T>, bool)

    Retrieves all components of the given type in all loaded scenes

    GetComponentsInScene<T>(Scene, List<T>, bool)

    Retrieves all components of the given type in a scene

    GetNamedChild(GameObject, string)

    Gets a descendant GameObject with a specific name

    Instantiate(GameObject, Transform, bool)

    Clones the GameObject, original, and returns the clone. This method also calls GameObjectInstantiated.

    Instantiate(GameObject, Transform, Vector3, Quaternion)

    Clones the GameObject, original, and returns the clone. This method also calls GameObjectInstantiated.

    Instantiate(GameObject, Vector3, Quaternion)

    Clones the GameObject, original, and returns the clone. This method also calls GameObjectInstantiated.

    Events

    Name Description
    GameObjectInstantiated

    Called when a GameObject has been instantiated through the GameObjectUtils versions of Instantiate.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)