Struct NetworkBehaviourReference
A helper struct for serializing Network
Inherited Members
Namespace: Unity.Netcode
Assembly: Unity.Netcode.Runtime.dll
Syntax
public struct NetworkBehaviourReference : INetworkSerializable, IEquatable<NetworkBehaviourReference>
Constructors
NetworkBehaviourReference(NetworkBehaviour)
Creates a new instance of the NetworkBehaviourReference<T> struct.
Declaration
public NetworkBehaviourReference(NetworkBehaviour networkBehaviour)
Parameters
Type | Name | Description |
---|---|---|
Network |
networkBehaviour | The Network |
Exceptions
Type | Condition |
---|---|
Argument |
Methods
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj |
Returns
Type | Description |
---|---|
bool |
Overrides
Equals(NetworkBehaviourReference)
Declaration
public bool Equals(NetworkBehaviourReference other)
Parameters
Type | Name | Description |
---|---|---|
Network |
other |
Returns
Type | Description |
---|---|
bool |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Overrides
NetworkSerialize<T>(BufferSerializer<T>)
Provides bi-directional serialization to read and write the desired data to serialize this type.
Declaration
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
Parameters
Type | Name | Description |
---|---|---|
Buffer |
serializer | The serializer to use to read and write the data. |
Type Parameters
Name | Description |
---|---|
T | Either BufferSerializerReader or BufferSerializerWriter, depending whether the serializer is in read mode or write mode. |
TryGet(out NetworkBehaviour, NetworkManager)
Tries to get the Network
Declaration
public bool TryGet(out NetworkBehaviour networkBehaviour, NetworkManager networkManager = null)
Parameters
Type | Name | Description |
---|---|---|
Network |
networkBehaviour | The Network |
Network |
networkManager | The networkmanager. Uses Singleton to resolve if null. |
Returns
Type | Description |
---|---|
bool | True if the Network |
TryGet<T>(out T, NetworkManager)
Tries to get the Network
Declaration
public bool TryGet<T>(out T networkBehaviour, NetworkManager networkManager = null) where T : NetworkBehaviour
Parameters
Type | Name | Description |
---|---|---|
T | networkBehaviour | The Network |
Network |
networkManager | The networkmanager. Uses Singleton to resolve if null. |
Returns
Type | Description |
---|---|
bool | True if the Network |
Type Parameters
Name | Description |
---|---|
T | The type of the networkBehaviour for convenience. |
Operators
implicit operator NetworkBehaviourReference(NetworkBehaviour)
Implicitly convert Network
Declaration
public static implicit operator NetworkBehaviourReference(NetworkBehaviour networkBehaviour)
Parameters
Type | Name | Description |
---|---|---|
Network |
networkBehaviour | The Network |
Returns
Type | Description |
---|---|
Network |
The Network |
implicit operator NetworkBehaviour(NetworkBehaviourReference)
Implicitly convert Network
Declaration
public static implicit operator NetworkBehaviour(NetworkBehaviourReference networkBehaviourRef)
Parameters
Type | Name | Description |
---|---|---|
Network |
networkBehaviourRef | The Network |
Returns
Type | Description |
---|---|
Network |
The Network |