- Home /
UCE0001: ';' expected. Insert a semicolon at the end?
I'm trying to make a FPS. I followed the FPS Tutorial correctly. Now I have to make the missile explosion . I copied and then pasted the unity's scrip onto my JavaScript then I test the game and it says, 'All compiler errors must be fixed before you can enter playmode!' Then at the bottom of the window it says, 'Assets/Weapons/Scripts/Missile.js(2,4): UCE0001: ';' expected. Insert a semicolon at the end.' I don't know how to fix this. Can someone please help me?
The first answer I got didn't work, so I'm going to show you all the script. I don't know if it will help. I changed the Script name from '$$anonymous$$issile' to 'Explosion'.
Here is the Explosion script.
var explosion : GameObject;
11function OnCollisionEnter( collision : Collision )
{
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation( Vector3.up, contact.normal );
var instantiatedExplosion : GameObject = Instantiate(
explosion, contact.point, rotation );
Destroy( gameObject );
}
You have a stray 11 going on there. How could you not notice that?
Answer by SrBilyon · Jul 07, 2011 at 09:51 PM
This should fix it. Credits to Dreamblur.
var explosion : GameObject;
function OnCollisionEnter( collision : Collision )
{
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation( Vector3.up, contact.normal );
var instantiatedExplosion : GameObject = Instantiate(
explosion, contact.point, rotation );
Destroy( gameObject );
}
Answer by GuyTidhar · Jul 07, 2011 at 06:28 PM
Go to the script named "Missile.js"
Found at: "Assets/Weapons/Scripts/Missile.js".
Look for row number 2. At the end ( character No.4?) there should be a ";" to tell the compiler this is the end of a line of code.
Add ; at the location.