Hello, I’m new to Unity. I’m using very basic networking. The line that instantiates my new players looks like:
var myNewTrans : Transform = Network.Instantiate(playerPrefab, transform.position, transform.rotation, 0);
(from the networking tutorial, part 2b spawnscript)
this creates a player object, which has a camera as a child. I think i need to set my Camera’s target field, but i have no idea how to say that in javascript.
Right now i just have the camera’s target set to the player prefab. But i think it gets confused when multiple players are instantiated, cuz the camera on player 1 flips to player 2 when he gets instantiated, and likewise, player 2’s camera flips over to targeting player 1.
you must be making a mistake somewhere.
This is how i do it :
cam = GameObject.Find(“Main Camera”);
sf = cam.GetComponent(SmoothFollow);
sf.target = this.transform;