Unity says a semicolon is needed at the end of the line, when i already have one there

#pragma strict

// Size of Textures
var size : Vector2 = new Vector2(240, 40);

// Health Variables
var healthPos : Vector 2=new Vector(20,20);
var healthBarDisplay : float = 1;
var healthBarEmpty : Texture2D;
var healthBarFull : Texture2D;

//Hunger Variables
var hungerPos : Vector 2 = new Vector(20,60);
var hungerBarDisplay : float = 1;
var hungerBarEmpty : Texture2D;
var hungerBarFull : Texture2D;

//Thirst Variables
var thirstPos : Vector 2 = new Vector(20,100);
var thirstBarDisplay : float = 1;
var thirstBarEmpty : Texture2D;
var thirstBarFull : Texture2D;

//Stamina Variables
var staminaPos : Vector 2 = new Vector(20,100);
var staminaBarDisplay : float = 1;
var staminaBarEmpty : Texture2D;
var staminaBarFull : Texture2D;

//fall Rate
var healthFallRate : int = 200;
var hungerFallRate : int = 150;
var thirstFallRate : int = 100;
var healthFallRate : int = 35;

private var chMotor : CharacterMotor;
private var controller : CharacterController;

var canJump : boolean = false;

var jumpTimer : Float = 0.7;

Function Start()
{
    chMotor = GetComponent(CharacterMotor);
    controller = GetComponent(CharacterController);
}

function OnGUI()
{
    GUI.BeginGroup(new Rect (healthPos.x, healthPos.y, size.x, size.y));
    GUI.Box(Rect(0, 0, size.x, size.y), healthBarEmpty);
}

It says i need a ‘;’ as in this screen shot when i already have one…

SCREENSHOT

Line 7, 13, 19 and 25 have a type Vector which isn’t defined. You need to use Vector2, just like line 4. Also, line 43 appears to have a capital F in the function.

(I formatted your code for you, too.)

1 Like

Thanks it works now…