Hi guys, i cant realize what is wrong. I’m already using RPC for lots of things but really i dont know why i cant get working this one with every player that is connected to the room . When this is executed it will give results only on the executing client and not also at the others, here is the code :
//Checking Collisions with Bullets
void OnCollisionEnter(Collision col){
if (col.gameObject.tag == "Bullet") {
Debug.Log ("Took Damage");
if(photonView.isMine)
takeDamage(col.gameObject.name);
}
}
//Handling damage
void takeDamage(string shooter){
health -= damage;
if (health <= 0) {
photonView.RPC("SetKillBoxText",PhotonTargets.All,PhotonNetwork.player.name,shooter);
anim.SetBool("Die",true);
}
}
[RPC]
public void SetKillBoxText(string killed,string killer){
killText.text = killed + " was killed by " + killer;
}
so if player A dies by player B Bullets, only player A will get the text " A was killed by B" …
the killtext is just a text object put on playerUI
why O_O?