Invisible trap workaround

Options
Hi,

in our game we need to create an invisibile trap that explodes when other players touch it.

Now we create trap with PhotonNetwork.Instantiate(), called by the client who wants to put the mine.

When a player touch it, the owner of the mine send an RPC 'AllViaServer' that say Explode()... We want that this RPC means "Explode and destroy". How can we represent this logic? Simply added a:

if (photonView .isMine)
{
PhotonNetwork.Destroy();
}

at the end of the RPC function?

Or each client destroy its own instance?

What is the better solution in this cases?

Thank you very much,
Andrea.

Comments

  • vadim
    Options
    Hi,

    Every object created with PhotonNetwork.Instantiate() should be destroyed with single call of PhotonNetwork.Destroy() from the client who spawned the object (owner). All network instances of this object will be destroyed automatically. So code with "if (photonView .isMine)" should work.