I want to create a button which is when player clicked,three button will appear.Player can choose which level to play when they click those three button.
That's easy:
if (GUILayout.Button("click to show more buttons"))
{
if (GUILayout.Button("Button A"))
DoSomething();
if (GUILayout.Button("Button B"))
DoSomethingElse();
if (GUILayout.Button("Button C"))
DoSomethingCompletelyDifferent();
}
var showButtons : boolean = false;
if (GUILayout.Button("click to show more buttons"))
{
showButtons = true;
}
if (showButtons)
{
if (GUILayout.Button("Button A"))
DoSomething();
if (GUILayout.Button("Button B"))
DoSomethingElse();
if (GUILayout.Button("Button C"))
DoSomethingCompletelyDifferent();
}
try this tweak of Jake L's suggestion.