how can i allow players to select the level they want to

Hey guys i am kind of new to unity and i made a 3d game i want some improvements in it

i made a scene like a menu with the new UI with buttons

but the buttons doesnt work
it doesnt see the function function StartGame (){ Application.LoadLevel("LevelName"); }
when i go to the button in the component OnClick

By the way i can use C# and Java so tell me the problem

it doesnt recognize the function

Please Help

2 Answers

2

Is StartGame() public?

yes it is public class

do it like this
public void StartMyGame(){
Application.LoadLevel(“Level1”);
}
add this to your ui button and on click select the button where script is added and then select
StartMyGame
it will work :smiley: