jackmerrill
New member
Hi there! I'm using the Opsive EventHandler and registering `OnDeath` to an event. However, the Death event doesn't seem to run when a player is killed by another player.
Code for registering:
OnDeath method:
Nothing is logged, nothing happens.
What do I do? Am I doing something wrong?
Thanks!
Code for registering:
C#:
EventHandler.RegisterEvent<Vector3, Vector3, GameObject>(gameObject, "OnDeath", OnDeath);
OnDeath method:
C#:
private void OnDeath(Vector3 pos, Vector3 force, GameObject attacker)
{
Debug.Log("Death");
if (attacker != null)
{
PhotonView attackerView = attacker.GetComponent<PhotonView>();
Debug.Log("Attacker " + attackerView.Owner.NickName + " killed " + PhotonNetwork.LocalPlayer.NickName);
onDeath.Invoke(attackerView);
}
}
Nothing is logged, nothing happens.
What do I do? Am I doing something wrong?
Thanks!