Noticias

¡RECUERDA QUE SI ERES UN NUEVO USUARIO, DEBES PRESENTARTE PARA PODER PUBLICAR MENSAJES! | TENEMOS CANAL OFICIAL DE TELEGRAM: t.me/unity3dspain

Atacar con espada

Iniciado por Luxskkz, Marzo 09, 2017, 12:35:21 AM

Tema anterior - Siguiente tema
Hola, quisiera saber si alguien me podría ayudar estoy intentando de hacer que mi personaje haga daño con la espada pero me tira el siguiente error(Ver Imagen)
 

 


Este es el Script:
 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class sword : NetworkBehaviour {
public NetworkView nv;
void Start() {
nv = GetComponent<NetworkView>();
}
[RPC]
public void applyDamage()
{
//health = health - dmg;
Debug.Log ("hit");
}
public void OnTriggerEnter(Collider other){
if(other.gameObject.tag == "Player"){
nv.RPC("applyDamage", RPCMode.AllBuffered, null);
}
}
}

 
 

¿Legacy Networking? ¿Aún funciona?...
 
¿El jugador es Autoritativo?
 
¿Estas intentando armar al multijugador de esa manera?
 
 
 
 

Investigando un poco vi de lo que hablas, así que modifique el script pero me tira un error de
 
"Trying to send command for object without authority. "
 
entonces puse el !isLocalPlayer, pero al colocarlo no ejecuta nada deja tirar el error mencionado pero no hace nada, entonces no se que hacer :c
 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class sword : NetworkBehaviour {
[Command]
void Cmdapply()
{
        //health = health - dmg;
   Debug.Log ("hit");
}
public void OnTriggerEnter(Collider other){
   if(other.gameObject.tag == "Player"){
   /*if (!isLocalPlayer) {
           return;
    }*/
      Cmdapply();
   }
}
}

 
 

Etiquetas: