Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Network.Destroy and RPC buffer

Discussion in 'Multiplayer' started by seb, Oct 17, 2008.

  1. seb


    Oct 3, 2008
    Hi all!

    Ok, Maybe there is something i am doing the wrong way in my code, but it seems that RPC calls buffered on Network.Instantiate are not removed from the RPC buffer by calling Network.Destroy.

    Players that connect after an object has been network destroyed do receive the RPC call for something that does not exist any more. Is it the expected behavior ? Is there something I should be aware of?

    Thanks for your help!

  2. ProtonOne


    Mar 8, 2008
    You need to clear out the RPC buffer for that player:

    Code (csharp):
    1. function OnPlayerDisconnected(player: NetworkPlayer) {
    2.    Debug.Log("Clean up after player " + player);
    3.    Network.RemoveRPCs(player);
    4.    Network.DestroyPlayerObjects(player);
    5. }