- Home /
Why does loading the scene not work?
I'm creating a game with a start menu. In the start menu, I currently have two buttons:
Play
Quit
The functions are in the same script, I have added the functions to the onclick events of the buttons but only the quit button works. If I click the Play Button, nothing happens. I have already tried to load the scene using build index and scene_name
Now some screenshots:
Answer by Tobi_04 · Sep 30, 2018 at 06:32 AM
RocketFriday
Thanks a lot for your answers, but the only reason why it didn't work is that the onclick events were set to off.
Answer by RocketFriday · Sep 29, 2018 at 11:39 AM
First of all I'm pretty sure methods need to be capitalized but I I could be wrong. Either way it's just good practice. Secondly, have you added the scene to the build index under build settings?
If so, the only other thing I can think of is your target graphic or raycasting. If the target graphic is offset from where your source image is then you aren't actually clicking the button. And as for raycasting. Make sure, there's no other UI with "Raycast Target" enabled that might be rendering over top your button. Like a panel or something.
Add: Print("Loading");
To your method to make sure it's being called.
Also make sure your reference to the script is in the scene. Don't think it works if you pull it straight from your assets folder.