As the tittle says, what code would i put into the Update code.
i have health bars above every player and i need their hp bars set to what their life actually is so other players know how much life they have.
i have this at the moment that damages the player if he collides with a cube.
public class Dammage : Photon.MonoBehaviour {
public Slider healthBarSlider;
void OnTriggerStay(Collider other){
if (other.gameObject.name == "Pain" && healthBarSlider.value > 0) {
healthBarSlider.value -= .10f; //reduce health
}
}
[RPC] void Update(){
//this part is what i am confused about.
}
}
apparently it needs another parameter or something "The best overloaded method match for `PhotonView.RPC(string, PhotonPlayer, params object[])' has some invalid arguments" this damage script is attached to the player prefab
sorry i forgot to mention that i am using photon i thought that it was there, well it says it "Photon.MonoBehaviour" just not stated
– killa247In Photon unity networking, private float m_Health; private void OnTriggerEnter(Collider other) { PhotonView photonView = this.photonView; photonView.RPC("ReduceHealth", RPCMode.All); // Call to RPC function } [RPC] public void ReduceHealth() { m_Health --; } Check [Photon Class Reference][1] [1]: http://doc-api.exitgames.com/en/realtime/current/pun/doc/class_photon_network.html
– praveeeapparently it needs another parameter or something "The best overloaded method match for `PhotonView.RPC(string, PhotonPlayer, params object[])' has some invalid arguments" this damage script is attached to the player prefab
– killa247also i need new players that join the game to be updated with other players current health
– killa247Oh sorry, Not RPCMode, should be "PhotonTargets" :) private float m_Health; private void OnTriggerEnter(Collider other) { PhotonView photonView = this.photonView; photonView.RPC("ReduceHealth", PhotonTargets.All); // Call to RPC function } [RPC] public void ReduceHealth() { m_Health --; }
– praveee