When started up, my game creates a character prefab and loads him into the game world. I have a camera object and a minimap camera that both need to reference this character and use it. On the “target” variable for my camera scripts I set it as my prefab. But when I start the game the cameras will not “lock” onto my character. The character does load into the game and I can change the target of the cameras so it does lock to the character but I want that to happen automatically when I start the game.
You need the instance of the character to be the thing you are tracking, not the prefab. A prefab is an inactive prototype GameObject that always stays in the assets at runtime. When you Instantiate it, you get an active copy of the prefab. You want the camera tracking that new copy, not the inactive original.
So you will need to inform the camera when you Instantiate. There are many possible ways of doing this. For example, the camera script could be told only about the Spawner object, and that Spawner could keep a record of the character each time it is instantiated so that the Camera can look it up whenever it needs it:
transform.LookAt(spawner.character.transform);
Or, the camera could look it up:
private var target : GameObject;
...
if (!target )
target = GameObject.FindWithTag("Player");
Or, the Spawner could know about the camera script, and set it there when in instantiates:
cameraScript.target = Instantiate(playerPrefab);