Class NetworkBehaviourPrePostSpawnTests.NetworkBehaviourPreSpawn
Inheritance
NetworkBehaviourPrePostSpawnTests.NetworkBehaviourPreSpawn
Inherited Members
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Namespace: Unity.Netcode.RuntimeTests
Assembly: Unity.Netcode.RuntimeTests.dll
Syntax
public class NetworkBehaviourPrePostSpawnTests.NetworkBehaviourPreSpawn : NetworkBehaviour
Fields
NetworkVarValueMatches
Declaration
public bool NetworkVarValueMatches
Field Value
Type | Description |
---|---|
bool |
OnNetworkPreSpawnCalled
Declaration
public bool OnNetworkPreSpawnCalled
Field Value
Type | Description |
---|---|
bool |
TestNetworkVariable
Declaration
public NetworkVariable<int> TestNetworkVariable
Field Value
Type | Description |
---|---|
NetworkVariable<int> |
ValueToSet
Declaration
public static int ValueToSet
Field Value
Type | Description |
---|---|
int |
Methods
OnNetworkPreSpawn(ref NetworkManager)
Gets called after the NetworkObject is spawned. No NetworkBehaviours associated with the NetworkObject will have had OnNetworkSpawn() invoked yet. A reference to NetworkManager is passed in as a parameter to determine the context of execution (IsServer/IsClient)
Declaration
protected override void OnNetworkPreSpawn(ref NetworkManager networkManager)
Parameters
Type | Name | Description |
---|---|---|
NetworkManager | networkManager |
Overrides
Remarks
a ref to the NetworkManager since this is not yet set on the NetworkBehaviour
The NetworkBehaviour will not have anything assigned to it at this point in time.
Settings like ownership, NetworkBehaviourId, NetworkManager, and most other spawn related properties will not be set.
This can be used to handle things like initializing/instantiating a NetworkVariable or the like.
OnNetworkSpawn()
Gets called when the NetworkObject gets spawned, message handlers are ready to be registered and the network is setup.
Declaration
public override void OnNetworkSpawn()