Search Unity

Timing of NetworkServer.Destroy and ordered RPCs

Discussion in 'Multiplayer' started by shadiradio, Dec 21, 2016.

  1. shadiradio

    shadiradio

    Joined:
    Jun 22, 2013
    Posts:
    83
    I've been struggling to figure out how to properly time destroying objects over the network that have RPCs incoming at the same time. Example: if you need to call an RPC on an object, THEN destroy it, you can't do this reliably. Half the time, the destroy will happen on clients before the RPC, then you get missed RPC warnings in the console because the object is gone. If you need to have those RPCs happen before destruction, how can you time this?

    The same issue applies to Unspawning or deactivation objects if you are trying to implement network pooling. These actions happen before RPCs even if you call the RPCs first. Is there any way to force the destroy calls into the ordered channel?