Hi folks, I’m new to Unity.
I use following code to quit my application, but the WebGL build crashes my Firefox when I call Application.OpenURL(). WebPlayer build works fine.
void Update ()
{
// Exit game?
if (Input.GetKeyDown (KeyCode.Escape)) {
if (Application.platform == RuntimePlatform.WebGLPlayer
|| Application.platform == RuntimePlatform.WindowsWebPlayer
|| Application.platform == RuntimePlatform.OSXWebPlayer) {
// Browsers go back to home
Application.OpenURL ("http://localhost/");
}
#if UNITY_EDITOR
else if (Application.platform == RuntimePlatform.WindowsEditor
|| Application.platform == RuntimePlatform.OSXEditor) {
// Editors stop game mode
UnityEditor.EditorApplication.isPlaying = false;
}
#endif
else {
// Standalone builds just quit
Application.Quit ();
}
}
}
Is this a known issue? Or, I should not even use Application.OpenURL to quit my browser application?
Some spec reports:
Unity 5.1.0f3
Firefox 38.0.5: WebGL - Crashes on Application.OpenURL
Chrome: WebGL - Works fine
IE: WebGL - Whole app crashes (I know it’s not well supported yet, so it’s ok.)