Class NetworkPrefaInstanceHandler
The Prefab instance handler to use for this test
Implements
Inherited Members
Namespace: Unity.Netcode.RuntimeTests
Assembly: Unity.Netcode.RuntimeTests.dll
Syntax
public class NetworkPrefaInstanceHandler : INetworkPrefabInstanceHandler
Constructors
NetworkPrefaInstanceHandler(NetworkObject)
Declaration
public NetworkPrefaInstanceHandler(NetworkObject networkObject)
Parameters
Type | Name | Description |
---|---|---|
Network |
networkObject |
Methods
Destroy(NetworkObject)
Invoked on Client and Server
Once an implementation is registered with the Network
Server Side: destroyed or despawned with the destroy parameter equal to true If Despawn(bool) is invoked with the default destroy parameter (i.e. false) then this method will NOT be invoked!
Client Side: destroyed when the client receives a destroy object message from the server or host.
Note on Pooling: When this method is invoked, you do not need to destroy the NetworkObject as long as you want your pool to persist.
The most common approach is to make the Network
Declaration
public void Destroy(NetworkObject networkObject)
Parameters
Type | Name | Description |
---|---|---|
Network |
networkObject | The Network |
Instantiate(ulong, Vector3, Quaternion)
Client Side Only
Once an implementation is registered with the Network
Note On Hosts: Use the Register
Note on Pooling: If you are using a NetworkObject pool, don't forget to make the NetworkObject active
via the Set
Declaration
public NetworkObject Instantiate(ulong ownerClientId, Vector3 position, Quaternion rotation)
Parameters
Type | Name | Description |
---|---|---|
ulong | ownerClientId | the owner for the Network |
Vector3 | position | the initial/default position for the Network |
Quaternion | rotation | the initial/default rotation for the Network |
Returns
Type | Description |
---|---|
Network |
StillHasInstances()
Declaration
public bool StillHasInstances()
Returns
Type | Description |
---|---|
bool |