docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method GetOrInstantiate

    GetOrInstantiate(GameObject)

    Retrieves an existing instance of the given prefab from the cache if available. Otherwise, instantiate a new instance of the given prefab.

    Declaration
    public GameObject GetOrInstantiate(GameObject prefab)
    Parameters
    Type Name Description
    GameObject prefab
    Returns
    Type Description
    GameObject
    Exceptions
    Type Condition
    ArgumentException
    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)