docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct NetworkObjectReference

    A helper struct for serializing NetworkObjects over the network. Can be used in RPCs and NetworkVariable<T>.

    Implements
    INetworkSerializable
    IEquatable<NetworkObjectReference>
    Inherited Members
    ValueType.ToString()
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetType()
    Namespace: Unity.Netcode
    Assembly: solution.dll
    Syntax
    public struct NetworkObjectReference : INetworkSerializable, IEquatable<NetworkObjectReference>

    Constructors

    Name Description
    NetworkObjectReference(NetworkObject)

    Creates a new instance of the NetworkObjectReference struct.

    NetworkObjectReference(GameObject)

    Creates a new instance of the NetworkObjectReference struct.

    Properties

    Name Description
    NetworkObjectId

    The NetworkObjectId of the referenced NetworkObject.

    Methods

    Name Description
    Equals(object)

    Indicates whether this instance and a specified object are equal.

    Equals(NetworkObjectReference)

    Indicates whether the current object is equal to another object of the same type.

    GetHashCode()

    Returns the hash code for this instance.

    NetworkSerialize<T>(BufferSerializer<T>)

    Provides bi-directional serialization to read and write the desired data to serialize this type.

    TryGet(out NetworkObject, NetworkManager)

    Tries to get the NetworkObject referenced by this reference.

    Operators

    Name Description
    implicit operator NetworkObjectReference(NetworkObject)

    Implicitly convert NetworkObject to NetworkObjectReference.

    implicit operator NetworkObject(NetworkObjectReference)

    Implicitly convert NetworkObjectReference to NetworkObject.

    implicit operator GameObject(NetworkObjectReference)

    Implicitly convert NetworkObjectReference to GameObject.

    implicit operator NetworkObjectReference(GameObject)

    Implicitly convert GameObject to 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)