Method Destroy
Destroy(NetworkObject)
Invoked on Client and Server Once an implementation is registered with the NetworkPrefabHandler, this method will be called when a Network Prefab associated NetworkObject is:
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 NetworkObject inactive by calling SetActive(bool).
Declaration
void Destroy(NetworkObject networkObject)
Parameters
Type | Name | Description |
---|---|---|
NetworkObject | networkObject | The NetworkObject being destroyed |