I’m new to Unity (via AS3), and have scoured the forum trying different things, but I am proper stuck. Must be a n00bie hurdle
All I want to do is control a camera rotation with a GUI button and, at present, my error is “Unexpected token: cam”. I would really love some help
My ButtonScript.js is…
var customSkin:GUISkin;
var cam: CameraScript;
function Start () {
}
function Update () {
}
function OnGUI(){
if(GUI.Button( Rect(10, 10, 320, 80), “Cha…”))
{
cam: GameObject.FindWithTag(“MainCamera”).GetComponent(CameraScript);
cam.moveCameraPlus();
}
}
and my CameraScript.js
var target:Transform;
function Start () {
transform.LookAt(target);
}
function Update () {
moveHorz = Input.GetAxis(“Horizontal”);
if (moveHorz > 0){
moveCameraPlus();
}
else if (moveHorz < 0){
moveCameraNeg();
}
}
public function moveCameraPlus () {
transform.LookAt(target);
transform.Translate(Vector3(0,100,0).right * (Time.deltaTime));
}
public function moveCameraNeg () {
transform.LookAt(target);
transform.Translate(Vector3(0,100,0).left * (Time.deltaTime));
}