- Home /
Why it still need me to add a ";"?
var speed = new Vector2(10,10);
var movement : Vector2;
var weapon : WeaponScript;
int life;
function Start () {
weapon = gameObject.GetComponent(WeaponScript);
}
function Update () {
var inputX = Input.GetAxis("Horizontal");
var inputY = Input.GetAxis("Vertical");
movement = new Vector2(speed.x * inputX, speed.y * inputY);
if(Input.GetButtonDown("Fire1")) {
weapon.Attack();
}
}
function FixedUpdate() {
rigidbody2D.velocity = movement;
}
the line "int life;" it need me to add a ";" why?
Comment
Answer by Landern · May 07, 2014 at 04:05 PM
you are declaring the in var incorrectly in UnityScript use:
var life:int;
Your answer
![](https://koobas.hobune.stream/wayback/20220613144452im_/https://answers.unity.com/themes/thub/images/avi.jpg)