docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Operator implicit operator

    implicit operator NetworkObject(NetworkObjectReference)

    Implicitly convert NetworkObjectReference to NetworkObject.

    Declaration
    public static implicit operator NetworkObject(NetworkObjectReference networkObjectRef)
    Parameters
    Type Name Description
    NetworkObjectReference networkObjectRef

    The NetworkObjectReference to convert from.

    Returns
    Type Description
    NetworkObject

    The NetworkObject the NetworkObjectReference is referencing

    implicit operator NetworkObjectReference(NetworkObject)

    Implicitly convert NetworkObject to NetworkObjectReference.

    Declaration
    public static implicit operator NetworkObjectReference(NetworkObject networkObject)
    Parameters
    Type Name Description
    NetworkObject networkObject

    The NetworkObject to convert from.

    Returns
    Type Description
    NetworkObjectReference

    The NetworkObjectReference created from the NetworkObject parameter

    implicit operator GameObject(NetworkObjectReference)

    Implicitly convert NetworkObjectReference to GameObject.

    Declaration
    public static implicit operator GameObject(NetworkObjectReference networkObjectRef)
    Parameters
    Type Name Description
    NetworkObjectReference networkObjectRef

    The NetworkObjectReference to convert from.

    Returns
    Type Description
    GameObject

    This returns the GameObject that the NetworkObject is attached to and is referenced by the NetworkObjectReference passed in as a parameter

    implicit operator NetworkObjectReference(GameObject)

    Implicitly convert GameObject to NetworkObject.

    Declaration
    public static implicit operator NetworkObjectReference(GameObject gameObject)
    Parameters
    Type Name Description
    GameObject gameObject

    The GameObject to convert from.

    Returns
    Type Description
    NetworkObjectReference

    The NetworkObjectReference created from the GameObject parameter that has a NetworkObject component attached to it

    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)