OnDeath Event GET ID Network

aledg

New member
Hi Guys, I'm using the OnDeath Event following the documentation

I can get the PhotonNetwork.LocalPlayer... that send the event (the attacker) but I want to know also the PhotonNetwork...(ID,Nickname ecc..) of the player who is death.....
What is the right way?



C#:
public class EventOnDeath : MonoBehaviour
{
    public void Awake()
    {
        EventHandler.RegisterEvent<Vector3, Vector3, GameObject>(gameObject, "OnDeath", OnDeath);
    }

    private void OnDeath(Vector3 position, Vector3 force, GameObject attacker)
    {

        Debug.Log("Attacker Info: "+PhotonNetwork.LocalPlayer.NickName +" : "+PhotonNetwork.LocalPlayer.UserId);
        Debug.Log("Death Info: "+PhotonNetwork.... +" : "+PhotonNetwork.....);

    }

    public void OnDestroy()
    {
        EventHandler.UnregisterEvent<Vector3, Vector3, GameObject>(gameObject, "OnDeath", OnDeath);
    }
}
 

Justin

Administrator
Staff member
This is probably a better question for the Photon forums but you can get the PhotonView from the attacker and then use that to get the name of the Photon Player. Where I am unsure is what the best method to get the Photon player based off of a PhotonView.
 
Top