Search Unity

Question Photon unity how to know which player dealt damage.

Discussion in 'Scripting' started by S4MA3L, Jul 22, 2020.

  1. S4MA3L

    S4MA3L

    Joined:
    Apr 17, 2020
    Posts:
    38
    I am developing a unity 2d multiplayer game using photon. I have a player throwing a projectile (grenade). The grenade script and damage system works. But how would I know which player, that projectile belongs to? Does photonnetwork.instantiate, tie that generated projectile to my player instance by any chance?
     
  2. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,605
    I have no idea about Photon, but you could simply make the grenade script have a public owner property and set that after instanitation. Now the grenade knows which player threw it and you are able to get that information back from it when needed.