- Home /
Can I display an Unity WebGL Game in Unity Editor ?
Hello,
I'm trying to put a HTML5 game (made with Unity WebGL export) in an Android app. I'm using a webview and the webview is correctly loading and displaying except my WebGL game, I see the loader and a white screen right after. It seems that the game never finish loading in Editor.. What is wrong with it, the web browser ? Unity ?
When I build it (APK), it says that it could not run and I should try to download Firefox (I have Firefox as default browser) but still not showing up.
Is there a Unity preferences to use a specific browser when I open URLs ?
Thank you for your time/help.
Answer by tanoshimi · Jul 21, 2017 at 02:36 PM
WebGL is not supported on mobile browsers, as documented at https://docs.unity3d.com/Manual/webgl-browsercompatibility.html
I'm not sure what you're trying to achieve - if you want to target Android devices, make an Android build.
This is generally true, however the Firefox for android is able to run WebGL on Android. However a native webview won't. The firefox ships it's own HT$$anonymous$$L rendering engine.
Thank you for your comment. I didn't want to make an Android build because I want to use this game on PC/$$anonymous$$ac and on Android with the same link through WebGL. That's why I use UniWebView to display the HT$$anonymous$$L page that contains the WebGL game on mobile devices.
About Firefox, I'm sure it can run WebGL on Android, the problem is that it keep saying that I need to install it on my device even if I already have it as default browser...
I don't get it. If you have a webGL game hosted on a webserver, you can simply open that webpage in firefox on your android device. There' no need to create a seperate android App that displays a webview. Again a webview can't run a WebGL application since a WebView doesn't support webGL and not even javascript. As you can read on the webview documation page if you want to view interactive content it's recommended to open the contant externally inside an actual browser.
edit
Just to be clear. Here i have my mandelbrot renderer as WebGL build hosted on a free hoster. You can reach it by this link here from a browser but it works exactly the same if i open that link inside firefox on my Nexus7. Though much much slower. WebGL is extremely demanding and limited. Running such content on a weak device such as an android phone or tablet does not work out well.
Thank you for answering Bunny. I wanted a webview with a WebGL game inside to avoid closing the actual app and opening a browser. I want my WebGL (HT$$anonymous$$L5) games that I use on the web into my android app either without going on a browser. That's why I use the plugin UniWebView that handle javascript. I was just wondering if I could do it even if it's a WebGL games inside the webview.
Your answer
Follow this Question
Related Questions
Unity iOS Android: open local HTML in Browser 1 Answer
Open a local html file in the Android's default browser 1 Answer
Need tip on better UI.Text control to control the paragraph alignment using tags. 1 Answer
Unity webgl or threejs or babylonjs ? Which one is the best for me? 1 Answer
VideoPlayer not playing in WebGL Build 0 Answers