docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Instantiate

    Instantiate(ulong, Vector3, Quaternion)

    Client Side Only Once an implementation is registered with the NetworkPrefabHandler, this method will be called every time a Network Prefab associated NetworkObject is spawned on clients

    Note On Hosts: Use the RegisterHostGlobalObjectIdHashValues(GameObject, List<GameObject>) method to register all targeted NetworkPrefab overrides manually since the host will be acting as both a server and client.

    Note on Pooling: If you are using a NetworkObject pool, don't forget to make the NetworkObject active via the SetActive(bool) method.

    Declaration
    NetworkObject Instantiate(ulong ownerClientId, Vector3 position, Quaternion rotation)
    Parameters
    Type Name Description
    ulong ownerClientId

    the owner for the NetworkObject to be instantiated

    Vector3 position

    the initial/default position for the NetworkObject to be instantiated

    Quaternion rotation

    the initial/default rotation for the NetworkObject to be instantiated

    Returns
    Type Description
    NetworkObject
    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)