I am trying to make a system where a type of enemy only attacks when it is in a group, and runs away when no other enemies are near by. I'm trying to do this by using tags, but the scripts keeps just finding itself, so it always thinks that there is another enemy with it. This is the code I'm using to identify close by enemies:
void Update()
{
friendly = GameObject.FindGameObjectWithTag("Enemy").transform;
{
If anyone could revise my system or find a better way of doing this it would be much appreciated.
↧