- Home /
Question by
dipixoft · Apr 19, 2014 at 12:03 AM ·
networkingrpcnetworkview
getting error with networkView
hi, again i'm trying to make a script used for apply damage to other players online but i'm getting this error"NullReferenceException: Object reference not set to an instance of an object controladorTaijutsu.aplicar (NetworkViewID id) (at Assets/MMOAsset/ScriptJugador/Taijutsu/controladorTaijutsu.js:173)" heres the code
function OnTriggerStay(otro : Collider)
{
if(otro.gameObject.tag == "Player")
{
if(otro.GetComponent(MovimientoJugadorBasico)){
if(modoAtaque){
if((Input.GetButtonUp("punch") || Input.GetButtonUp("kick")))
//otro.GetComponent(MovimientoJugadorBasico).recibirAtaque(modoAtaque,hit);
var viewID = otro.collider.networkView.viewID;
networkView.RPC("aplicar",RPCMode.All,viewID);
}
otro.GetComponent(MovimientoJugadorBasico).herido = modoAtaque;
}
}
}
this is the function called by the RPC
@RPC
function aplicar(id : NetworkViewID)
{
var enID = NetworkView.Find(id);
var en = enID.observed.gameObject; // this is the error line
en.gameObject.SendMessageUpwards("recibirAtaque",hit,SendMessageOptions.DontRequireReceiver);
}
thanks
Comment
Your answer
Follow this Question
Related Questions
Get NetworkPlayer from ViewID 1 Answer
Networking: RPC To Specific Player? 1 Answer
Couldn't Invoke RPC Function ! 1 Answer
networkView not called on Child objects? 0 Answers
Networking Error! 0 Answers