Implementation question: PhotonNetwork Instantiate/Destroy vs. RPC + GameObject.Destroy

Options
I am attempting to implement a trap set by a player that is destroyed upon collision (e.g.: banana from Mario Kart). Disclaimer: totally new to Photon (it seems awesome so far though). My current implementation is:

1. Player hits "Space" to drop trap
2. RPC "SetDeathtrap" is called with the trap's location (player's position at time of hitting spacebar)
3. When a player runs into the deathtrap, RPC is called to destroy the deathtrap

What are the pros/cons of this approach versus using PhotonNetwork.Instantiate + PhotonNetwork.Destroy? Are there differences? Is the latter approach feasible?

Comments

  • Hi Dakkerst,

    first of all both approaches are feasible and both have - more or less - their own pros and cons. However we strongly recommend you using Instantiate(...) and Destroy(...) since these functions are made for network instantiation and destruction by handling some necessary steps in the background, e.g. the assignment of an ID and the correct removing of the game object from all clients. If you want to use RPCs for instantiation and destruction, you can take a look at the manually instantiate documentation to get more information.