Instantiated enemy looks at player

I have an object that shoots small creatures to attack you. The creatures use an extremely simple attack system where they look at the player and are pushed forwards. Unfortunately,upon Instantiation the enemies lose their lookat target; the player. How would one spawn the enemies with the desired in-scene lookat target (or to go to the in-scene target that would be assigned as a prefab. Preferably the first.)


You could assign the target to the objects right after they're instantiated. Or, you could add code in the Awake() or Start() function of a script associated with the objects that searches for the player by (e.g.) name or tag. Or you could have a static variable somewhere that references the player, etc., etc.

In short, there are multiple solutions, but one way or another you'll need to 'give' the objects a reference to the player when they're created.