- Home /
Play Scene help
So I made a main menu Scene and made a script to attach a button. But I get an error. "Assets/_Scripts/MainMenu_Start.js(5,29): It is not possible to invoke an expression of type 'int'." Can anyone tell me what I did wrong? Thanks to anyone who helps! Should I remove the #pragma strict? or Did I mix something up? Anyways, thanks for the help!
Script:
#pragma strict
function Start () {
if(Input.GetMouseButtonDown(0)) {
Application.loadedLevel("StartScene");
}
}
function Update () {
}
Answer by SirCrazyNugget · Mar 05, 2014 at 09:56 PM
Application.loadedLevel is an int not a function and returns the index of the level which was last loaded.
I have a feeling you're actually after Application.LoadLevel("StartScene") to load the level.
Thank you! Haha always the small things. Also I attached it to a sprite (making a 2D game) and when I click the image, nothing happens...? Could you help with this error?