docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method MakeNetworkObjectTestPrefab

    MakeNetworkObjectTestPrefab(NetworkObject, uint)

    Normally we would only allow player prefabs to be set to a prefab. Not runtime created objects. In order to prevent having a Resource folder full of a TON of prefabs that we have to maintain, MultiInstanceHelper has a helper function that lets you mark a runtime created object to be treated as a prefab by the Netcode. That's how we can get away with creating the player prefab at runtime without it being treated as a SceneObject or causing other conflicts with the Netcode.

    Declaration
    public static void MakeNetworkObjectTestPrefab(NetworkObject networkObject, uint globalObjectIdHash = 0)
    Parameters
    Type Name Description
    NetworkObject networkObject

    The networkObject to be treated as Prefab

    uint globalObjectIdHash

    The GlobalObjectId to force

    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)