public static bool NetworkDestroy(ulong networkId)
{
// Make sure the object exists on the network before calling destroy
SimpleNetworkedMonoBehavior behavior = Locate(networkId);
if (behavior == null)
return false;
// Destroy the object from the scene and remove it from the lookup
GameObject.Destroy(behavior.gameObject);
lock (networkedBehaviorsMutex)
{
networkedBehaviors.Remove(networkId);
}
if (Networking.PrimarySocket.IsServer)
Networking.PrimarySocket.ClearBufferedInstantiateFromID(networkId);
return true;
}