i have problem, when i kill player i want there to be displaed information which was destroyed and who destroyed him it sort of works … i have one good message which is displayed but there are multiple messages displayed (only one is good) i have no idea why is that happening
this is part of my health script
[RPC]
public void TakeDamage(float amt,string by) {
currentHitPoints -= amt;
if(currentHitPoints <= 0) {
DieRespawn(by);
}
}
void DieRespawn(string by) {
manager.AddChatMessage(GetComponent<BetaMovement>().getName() + " is killed by : " + by);
if(GetComponent<PhotonView>().instantiationId==0){
Destroy (gameObject);
}
else{
if( PhotonView.Get(this).isMine ) {
manager.playerAlive = false;
manager.standbyCamera.SetActive(true);
PhotonNetwork.Destroy(gameObject);
}
}
}
this is how i add messages (they are displayed in label)
[RPC]
void AddChatMessage_RPC(string m) {
while(chatMessages.Count >= maxChatMessages) {
chatMessages.RemoveAt(0);
}
chatMessages.Add(m);
}