C# 如何制作弹出式吉他?
我有一个吉他的“设置”,我想当我点击它时,一些设置会显示出来,例如音乐开/关 单击设置按钮,音乐按钮出现。通过单击音乐按钮,您可以在游戏中静音/取消静音音乐 我该怎么做C# 如何制作弹出式吉他?,c#,unity3d,guitexture,C#,Unity3d,Guitexture,我有一个吉他的“设置”,我想当我点击它时,一些设置会显示出来,例如音乐开/关 单击设置按钮,音乐按钮出现。通过单击音乐按钮,您可以在游戏中静音/取消静音音乐 我该怎么做 private boolean displayMusic = false; private boolean musicOn = true; void OnGUI() { if (GUI.Button (new Rect (Screen.width / 2, Screen.height / 2, 150, 50), "
private boolean displayMusic = false;
private boolean musicOn = true;
void OnGUI() {
if (GUI.Button (new Rect (Screen.width / 2, Screen.height / 2, 150, 50), "Settings")) {
displayMusic = true; //If the settings button is clicked, display the music
// Here you could replace the above line with
// displayMusic = !displayMusic; if you wanted the settings button to be a
// toggle for the music button to show
}
if (displayMusic) { //If displayMusic is true, draw the Music button
if (GUI.Button (new Rect (Screen.width / 2, Screen.height / 2 + 50, 150, 50), "Music " + (musicOn ? "On" : "Off"))) {
musicOn = !musicOn; //If the button is pressed, toggle the music
}
}
}
我希望这有帮助如果你认为答案正确地回答了这个问题,请考虑把它标记为正确的。谢谢:)。