Error Assets/OrangeSpawnScript.js(4,33): UCE0001: ';' expected.

I’m getting error Assets/OrangeSpawnScript.js(4,33): UCE0001: ‘;’ expected. Insert a semicolon at the end. When there is a Semicolon there already. Not sure what to do been staring at this for hours and can’t figure it out. Any Help would be apperciate.

 var cubeList : GameObject[];
var randomCube  : GameObject  = cubeList[(int) (Random.value * cubeList.Length)];

cubeList doesn’t have anything initialized even if you are assigning values in the inspector. It’s field. The object needs to be created, fields can not assign to fields even though you can visually make an assumption of declaring the field and assigning values to a field. When an object is instantiated the fields come first, this allows them to be available to use in the constructor of a class/object.

update your code to assign in Start()

var cubeList : GameObject[];
var randomCube : GameObject;

function Start() {
  randomCube = cubeList[(int) (Random.value * cubeList.Length)];
}