Hi, I’m making a 3d minigame where I want to make the enemy follow two players, I have a spawn and the two players, but the enemy focus in one and dont change, what I want is that the enemy changes the focus when the other player is nearest than the other. Thank you!
Try to find the position of your players like that
Player1 = GameObject.FindGameObjectWithTag("Player1").transform;
...
then get the range of your enemy to the players
rangeplayer1 = Vector3.Distance(transform.position, Player1.position);
...
and then just look what distance is closer
if(rangeplayer1<rangeplayer2)
{transform.position=Vector3.Lerp(transform.position, Player1.position ...}
...