About 'Publish Your WebGL Game'!

Hi Rick!

Trying my game I found two main bugs that now are solved, but I think that could be usefull to share it.

The first bug was that we were using Alpha1, Alpha2, … to check the KeyDown event, but this is not working when using the keypad, so I change it for:

if(Input.GetKeyDown(KeyCode.Alpha1) || Input.GetKeyDown(KeyCode.Keypad1))

The second bug was that when using the Unity editor or the Html5 exported application, the Application.Quit() function was not working. So, after searching for a while I found this solution:

private void QuitGame()
{
#if (UNITY_EDITOR)
    UnityEditor.EditorApplication.isPlaying = false;
#elif (UNITY_STANDALONE) 
Application.Quit();
#elif (UNITY_WEBGL)
Application.OpenURL("about:blank");
#endif
}

The post is here:

Hope it helps!

1 Like