Unity shows the following warning on mobile devices up to Unity 2019.4: "Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway." This script helps you remove this warning
To see live examples see Unity Web GL Loading Test
The script will run after the build has completed and replace the checks from all generated javascript files.
- Tested up to Unity 2020.3, but should work with any version
- Works with
Name Files as Hashes
, since it looks for all js files in the Build folder - Only runs when building for WebGL, so you can use it for a multiplatform project
If you still see the message, there are several reasons why this could happen
- Make sure you included the file in an Editor folder inside your project (e.g.
Assets/Editor/RemoveMobileSupportWarningWebBuild.cs
) - Make sure you get a console log message "Removing mobile warning from YOURPATH" after the build is finished. If you don't get this message there is a problem with your integration of the script. Probably, the script is not in the Editor folder.
- Make sure you emptied your browser cache on the device you are testing on (Android | iOS)
- Try to open the website in private mode, might help with strage cache problems
- Take a look at Unity Web GL Loading Test. There you can see the script in action, take a look at how the script is integrated or build the repo yourself to see how it should behave.
- Inside you Build folder, take a look at the
*.js
file, and see if you can find an instance of "UnityLoader.SystemInfo.mobile". If you can still find that, the script didn't run properly. - If you need professional help, you can write me an email
- Unity adds this note, since the builds oftentimes don't work for mobile, so oftentimes it does make sense to include the info.
@ADCAbdulla Thanks for clarifying. I don't own the asset you linked to, but I'm quite certain I found the problem: I guess, in your in-app browser the variable
UnityLoader.SystemInfo.hasWebGL
is false. So what you can do, is remove all compatibility checks, so no warnings can be shown. You can search the unityloader.js forcompatibilityCheck:function
to find the code you need to remove (everything inside the function). For me, the code to remove looks like this:this needs to be replaced with
t()
.Remove the old script of mine, and replace it with this one:
You can also replace this function by hand, but that seems rather tedious to do, the script will do it for you :) Make sure the content is the same. I made a build with 2019.4.25f1 for you to test, if this solution works for you (I would be really surprised if the build still shows the message): https://deml.io/experiments/unity-webgl/2019.4.25f1-no-checks/