Set all prefabs

How can I set a component of all instances of a gameobject?

For example:
I have a few instances of a turret prefab.
I want all of the turrets to shoot at the player.
My player is not a prefab, for obvious reasons.
That means I can’t set the component in the turret prefab to shoot at the player.
I’m using a spawner to spawn the turrets, so I can’t see the turrets in the inspector before hand.
All my scripts are in c#.
I tried using this in my spawner script, but it didn’t work:

GameObject turret = Instantiate (objects [num], new Vector3(transform.position.x, -5.5f, transform.position.z), transform.rotation)as GameObject; // spawn the object
Transform head = turret.transform.Find("Head"); // find my child. the prefab is made up of the head(the part that shoots), and the body. I made them separate so the head can turn like all turrets do
TurretScript turretscript = head.GetComponent<TurretScript>(); // get the component in the head
turretscript.player = player; // assign the value I want

I’m getting this error message:

UnassignedReferenceException: The variable player of SpawnerScript has not been assigned.
You probably need to assign the player variable of the SpawnerScript script in the inspector.

My problem is that I can’t assign it in the inspector.
How can I solve this problem?

have you checked are you getting head ? add a null check after you get head.