How I can implement an enemy AI with navmesh in photon?

Options

Hi, I am work in a FPS proyect with unity and photon, I tried to add enemies with AI and add photon view component and photon animator but is not working

Comments

  • Tobias
    Tobias admin
    edited April 2021
    Options
    An NPC should be network instantiated like your player characters but it instead of applying input, some logic steers the character. The synchronization can be as simple as just applying the PhotonTransformView and PhotonAnimatorView on it but in a slightly competitive shooter, you want a much more elaborate approach, which can be a bit of work with PUN.

    Maybe you have a look at UFPS and the Photon / Networking addon?
    Might make sense to not implement this from scratch, if you are stuck with these questions.
  • Andresfelipe1117
    edited May 2021
    Options
    El enemigo que programe funciona correctamente offline , pero con photon se mueve en el mapa ,pero no detecta a el jugador, le agregue el photon view,el photon trasnform view, photon animator y los demas componentes correspondientes y aun asi no funciona , me sale : " null reference exception object reference not set to an instance of an object", porque no me detecta la jugador en esta linea : target = GameObject.Find("Jugador");
    vidaJugador = target.GetComponent<Vida>();//En el caso de photon esta linea es la que causa los errorees,en cambio en offline no causa error
    if (vidaJugador == null)
    {
    throw new System.Exception("El objeto jugador no tiene componente vida");
    }

    Esta linea solo me causa inconvenientes en photon , porque normalmente el enemigo persigue al jugador.

    Nota: Ya solucione este inconveniente de null reference y aun asi sigue sin funcionar correctamente,no me arroja ya ningun error en la consola , se ve que sabes del tema, si me pudieras facilitar un ejmeplo de como implementar la ia correctamente en photon te lo agradeceria
  • Tobias
    Options
    Forgot to translate?