Struct NetworkObjectReference
A helper struct for serializing NetworkObjects over the network. Can be used in RPCs and NetworkVariable<T>.
Inherited Members
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. |