Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Destroying the Network Object

Daniel McGuinness edited this page Sep 30, 2018 · 1 revision

One of the most common actions that you may want to do on the network is to destroy the various network objects that you create. Any object that has a networkObject or that derives from one of the generated classes made by the Network Contract Wizard (NCW) can be destroyed on the network. If you have a reference to the object you wish to destroy then it is just a matter of calling one function:

networkObject.Destroy();

This will not only destroy the Network Object, but it will also call the UnityEngine.GameObject::Destroy method on the gameObject that the networkObject is attached to. If you wish to know when an object is destroyed you can register to the NetworkObject::onDestroy event.

networkObject.onDestroy += MyMethod;

Home

Getting Started
Network Contract Wizard (NCW)
Network Object
Remote Procedure Calls (RPCs)
Unity Integration
Basic Network Samples
Scene Navigation
NetWorker
Master Server
Web Server
Netcoding Design Patterns
Troubleshooting
Miscellaneous
Forge Networking Alloy
Steamworks
Clone this wiki locally