How do i write a script that when triggered switches out “camera1” for “camera2” in the
“n = camera1.transform.position - transform.position;” variable?.
I have tried severals ways but I’m new to unity and scripting in it so my tries were probably wrong. If someone could give me an example of how i could write it, I would massively thankful.
this is the Code
var go = GameObject.Find("camera1");
var camera1 : Transform;
var camera2 : Transform;
function start()
{
}
function Update()
{
var n = camera1.transform.position - transform.position;
transform.rotation = Quaternion.LookRotation( n );
if (go.GetComponent(GUI_cam).count == 2)
{
//CAMERA 1 GOES HERE
}
if (go.GetComponent(GUI_cam).count == 3)
{
//CAMERA 2 GOES HERE
}
}