Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何制作弹出式吉他?_C#_Unity3d_Guitexture - Fatal编程技术网

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
        }
    }
}

我希望这有帮助