Buttons not working on build

Hello, when i run my game in unity, my play button which loads a scene (level 1), but i build my game so that it is an app, i opened the app, main menu is visible but the buttons are not working. Any problems? i have no code for the buttons cause i don’t need any.

In order for a button to do something, it should have a function (void) attached to him, otherwise the button is just an image.

Make a new C# script, attach it to the canvas or any other gameobject. In the script itself, write these lines of code:

C#

     public void buttonLoadLevelOne () {
             Application.LoadLevel (x);
     }

Go to Unity, in the up right corner click on File > Build Settings and drag your level 1 scene to the field. Once you’ve done that you will see a number at the right side of the field. Take the number which is on the same line as the level1 scene and write it where you see X in the code above;

Once you have done that click on the button that should load level1 scene upon a click. On the Inspector panel, scroll down until you reach Button (Script), at its bottom there is a small field ‘On Click ()’. Click the + sign at the bottom of it, drag the gameobject from Hierarchy that contains the script onto None sign, then where it says NoFunction change it to ‘scriptName’.buttonLoadLevelOne.

This should make the button work on a click.

I am not good enough at explanations but if you need further clarification, I am happy to help you :slight_smile:

Do you have an Event System attached?
Remember that the scene number starts at 0.