MOBA minion AI: Programming logic?

Okay, so I’m creating the most simple MOBA in Unity for programming practice.

I need some help with the logic for the minions. So I have one prefab for the left-side minions and one for the right side minions, but I’m using a shared script for both types of minions. I’m assuming this is the best way to go but I’m struggling finding the other team’s minion objects through the script.

First I tried creating a public array of the minions in the opposite team for each prefab, just dragging and dropping the opposite side’s minion prefabs to it. I tried finding the closest minion in that array but the minions just started walking towards the coordinates of the prefab and not actually of the minions in the scene. I checked if the closest target was null, but it didn’t help. What am I doing wrong?

You’re probably using the prefab reference rather than the reference to the instance of the object you just created.

I think if you set the reference to the instance of the object that has been created in the scene instead of the prefab then everything should work out.