docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method IsPrefab

    IsPrefab(GameObject)

    Check whether a GameObject is a prefab.
    For editor only - some things are disallowed if prefab. In runtime, will always return false.

    Declaration
    public static bool IsPrefab(GameObject gameObject)
    Parameters
    Type Name Description
    GameObject gameObject

    the object to check

    Returns
    Type Description
    bool

    If editor, checks if object is a prefab or prefab instance.
    In runtime, returns false always

    In This Article
    Back to top
    Copyright © 2023 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)