Question by
ethranes · Mar 19, 2016 at 05:24 PM ·
javascriptcollisiontriggermonodevelopscene-switching
Javascript error on runtime semi colon required
Hi, I've got a short piece of JavaScript written that will switch a scene when the player collides with an object, however when I try and run the game I get a compiler error, It's saying that it's expecting a semi colon, and as far as I can tell there is a semi colon present, here is my code;
#pragma strict
using UnityEngine.SceneManagement;
function OnTriggerEnter(Col : Collider)
{
if(Col.tag == Player);
{
SceneManager.LoadScene(Win);
}
}
And here is the error that I'm getting on runtime;
Assets/Scripts/switchScene.js(2,6): UCE0001: ';' expected. Insert a semicolon at the end.
Any hep and advice given would be appreciated.
Comment
Best Answer
Answer by Ali-hatem · Mar 19, 2016 at 07:18 PM
if(Col.tag == Player)
delete the semi colon from here
Your answer
Follow this Question
Related Questions
How to raycast object as far as possible, without collision? 0 Answers
OnTriggerEnter no longer works 1 Answer
About UnityScript - us.exe compiler 0 Answers
ANIMATION TRIGGER DOESN'T PLAY 1 Answer