rpc message does not work
Would someone please get this fixed for me becouse again it sounds realy stupid but i cant get it to work
i tried this but its not working i tried to metch the parameters but its not working
RPC("AddjustCurrentHealth", RPCMode.All, (int adj, int curHealth);
[PunRPC]
public void AddjustCurrentHealth(int adj, int curHealth)
This is not working still get this message
NotImplementedException: The requested feature is not implemented. PhotonView.RPC (System.String v, RPCMode all, System.Object addjustCurrentHealth) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:671) EnemyHealth.OnCollisionEnter (UnityEngine.Collision col) (at Assets/EnemyHealth.cs:25)
i know its this line that is missing something.
photonView.RPC("AddjustCurrentHealth", RPCMode.All, curHealth);
here is the script
using UnityEngine;
using System.Collections;
using System;
[PunRPC]
public class EnemyHealth : MonoBehaviour
{
public int maxHealth = 100;
public int curHealth = 10;
void Awake()
{
PhotonView photonView = PhotonView.Get(this);
}
[PunRPC]
void OnCollisionEnter(Collision col)
{
if (col.transform.tag == "Bullet")
{
PhotonView photonView = PhotonView.Get(this);
photonView.RPC("AddjustCurrentHealth", RPCMode.All, curHealth);
//Destroy(gameObject);
}
}
[PunRPC]
public void AddjustCurrentHealth(int adj, float curHealth)
{
curHealth += adj;
if (curHealth < 0)
curHealth = 0;
if (curHealth > maxHealth)
curHealth = maxHealth;
if (maxHealth < 1)
maxHealth = 1;
if (curHealth < 10)
Die();
}
[PunRPC]
void Die()
{
PhotonView.Destroy(gameObject);
}
}
Do i need to do this??
photonView.RPC("AddjustCurrentHealth", RPCMode.All, (int adj, float curHealth);
this gives a error
i feel so stupid Becouse i dont understand it
someone named hexagonius tried to help me but i stil dont get it how its propperly done
so if someone Knows how this is done please help me : )
the parameters don't match again. you're calling the RPC with one, but it wants two. And you've out the Attribute to the class and OnCollisionEnter. That can't be right. There must be examples for Photon for how to do one Rpc. if you understood that it should not be a problem anymore.