Proper Spawning and Destroying

Options
I'm creating a game that players can defeats foes via multiplayer. Players can jump in and out at anytime, but I want to make sure that foes carry the correct state when new players join (such as health and whether or not they are dead or alive).

I'm instantiating the foes from the master client, and I'm "destorying" them by sending a buffered RPC to all PhotonTargets, but when a player joins the game, the foes that are suppose to be destroyed spawn anyway.

Comments

  • Tobias
    Options
    The opposite of Instantiate is Destroy, not an RPC.
    Destroy does more than just remove the GO, as it also takes care of the buffered instantiation on the server. You will have to destroy the GOs.
    If they are extremely short-lived (like a few seconds), then it's better to use (non buffered) RPCs instead of Instantiate and then you can use a RPC to control and get rid of them, too.
  • Ah, I should have worded things differently, but I managed to get things working. Now I'm instantiating the enemies via master client, and destroying them via sending out RPCs to all the clients to destroy them, so now they don't show up for new clients. Thank you!