How do I set a default target?

My “EnemyBasic” prefab is set to spawn in waves and successfully does but they need a target variable that is a transform type to have the “player” set, this way they move in a line towards the player. When they spawn, the player isn’t set in the target variable because you can’t save it in a prefab for some reason. Could I use a line of code in the wave spawn to set their target to the player? And if so, how? Thanks!

On the script that is attached to your “EnemyBasic” on the Start Function:

void Start() {
        target = GameObject.Find("The Name Of Your Player");

Like PrisVas Say you should use a GamObject.Find() or GamObject.FindWithTag(). But what you are miss here is that the target variable is a transform type not a gameobject type. So to solve this problem you ned to get the compent via GetComponent.<>(); comandline. Something like this.

var target : Transform;

function Start () {
    target = GameObject.Find("Player").GetComponent.<Transform>();

This should work.