- Home /
Question by
smithr3339 · Oct 20, 2013 at 10:25 PM ·
javascripterrorvector3variable
What is the problem with this code?
using UnityEngine;
using System.Collections;
public class CameraControls : MonoBehaviour {
Transform target;
int distance = -10;
int lift = 1.5
// Update is called once per frame
void Update () {
transform.position = target.position + Vector3(0, lift, distance);
transform.LookAt(target);
}
}
Comment
Answer by nastasache · Oct 20, 2013 at 10:47 PM
using UnityEngine;
using System.Collections;
public class CameraControls : MonoBehaviour {
public Transform target;
int distance = -10;
float lift = 1.5f;
void Update () {
transform.position = target.position + new Vector3(0, lift, distance);
transform.LookAt(target);
}
}
is float
missing ";" @ int lift = 1.5
missing (as vexe said) "new" - required in C#, not required in JS
Thanks! The first two I dont know why I missed :P but thanks for the help
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Errors with script using Javascript. 2 Answers
UnityScript coding error: 1 Answer
Scripting error! 1 Answer
Expressions in statements must only be executed for their side-effects. 1 Answer