Assets/Scripts/scriptEnemy.js(24,35): UCE0001: ';' expected. Insert a semicolon at the end.

Doing a Basic Unity Tutorial I came across the issue of the particle system not having a autodelete any more. I found a solution which is throwing up the error. Here is my code:

//Enemy Script

//Inspector Variables
var numberOfClicks 		: int = 2;
var respawnWaitTime 	: float = 2.0;
var shapeColour			: Color[];
var explosion			: Transform;
//Private Variables
private var storeClicks	:int = 0;

//Called once
function Start(){

	storeClicks = numberOfClicks;


//Called every frame
function Update(){

	if(numberOfClicks <= 0){
			GameObject newexplosion = (GameObject) Instantiate(explosion,transform.position,transform.rotation);
		var position = Vector3(Random.Range(-5,5),Random.Range(-5,5),12);
		transform.position = position;
		numberOfClicks = storeClicks;
//Used to hide the game object for a set amount of time, and then unhide it.
function RespawnWaitTime(){

	renderer.enabled = false;
	yield WaitForSeconds (respawnWaitTime);
	renderer.enabled = true;

//Changes the colour of the material of the game object
function RandomColour(){
	if(shapeColour.Length > 0){
		var newColour = Random.Range(0,shapeColour.Length);
		renderer.material.color = shapeColour[newColour];

I await your useful assistance.

That is a UnityScript code, but line 24 is C# (or looks like to me).


GameObject newexplosion = (GameObject) Instantiate(explosion,transform.position,transform.rotation);

Should be:

var newexplosion : GameObject = Instantiate(explosion,transform.position,transform.rotation);

I know its a very late reply. Since i came across the same problem whilst working on the same tutorial . Here is how i solved it .

//Inspector Variables

var explosion : Transform ;

And then in the update function

		var t : Transform = Instantiate(explosion,transform.position,transform.rotation);
		var newExplosion : GameObject = t.transform.gameObject;

Hi guys I’m having a similar issue in myHealthControl.J’s script.
The affeced line:
var healthBar: GameObject.HealthBarGUI.FindWithTag(“HealthBarGUI”);

Tht console says it is expecting ‘;’. Insert semicolon at the end. But I already have.
Any help is greatly appreciated.

Also. On a side note, I am a Modeler and concept artist by nature so this coding system is foreign to me. I am willing to barter assets for scrip and script based components. Email me if interested:
Thanks guys!