FindGameObjectsWithTag with no Clear

Willyx

New member
Hi, i'm using FindGameObjectsWithTag and calling multiple times adds GameObjects multiple times to the list.
Probably you should add storeValue.Value.Clear(); in line 17 like this:

public override TaskStatus OnUpdate()
{
storeValue.Value.Clear();
var gameObjects = GameObject.FindGameObjectsWithTag(tag.Value);
for (int i = 0; i < gameObjects.Length; ++i) {
storeValue.Value.Add(gameObjects);
}

return TaskStatus.Success;
}
 
Top