Could someone help me? Very basic Ai (Nav Mesh),So I created this Zombie AI, but i dont follows player by tag(multiplayer)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class ZombieController : MonoBehaviour {

public Transform target;
NavMeshAgent agent;

void Start()
{
    agent = this.GetComponent<NavMeshAgent>();
    target = GameObject.FindWithTag("Player").transform;
    agent.SetDestination(target.position);
}

void FixedUpdate()
{

    target = GameObject.FindWithTag("Player").transform;
    transform.LookAt(target);
}

it doenst work… I baked in the navigator and added the tag to the Player(Player).
Thank you! :]

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class NPCMove : MonoBehaviour
{

[SerializeField]
Transform _destination;

NavMeshAgent _navMeshAgent;
internal Transform destination;

// Use this for initialization
void Start()
{
    _navMeshAgent = this.GetComponent<NavMeshAgent>();

    if (_navMeshAgent == null)
    {
        Debug.LogError("The nav mesh agent component is not attached to " + gameObject.name);
    }
    else
    {
        SetDestination();
    }
}

public void SetDestination()
{
    if(_destination != null)
    {
        Vector3 targetVector = _destination.transform.position;
        _navMeshAgent.SetDestination(targetVector);
    }
}

public void Update()
{
    SetDestination();
}

}

This should work it took me awhile to make this one work for my old game but it worked just fine

So first thank you! But i want to define the target with tag… But thanks for your try :]

Hi @itsLolo , I have a complete script for zombieController, if you want the full script tell me and I’ll send it to you

Try something like this:

public class EnemyController : MonoBehaviour {
	NavMeshAgent nav; 
	Transform player;
    bool isDead = false;

void Awake () {
		nav = GetComponent <NavMeshAgent> ();
		player = GameObject.FindGameObjectWithTag ("Player").transform;
        }
void Update () {
		if(!isDead)
		{
			nav.SetDestination (player.position);
        }
}