Last active
February 27, 2021 00:42
-
-
Save De-Panther/f08cb4902bd21ee403d579a12510be2c to your computer and use it in GitHub Desktop.
Unity WebGL on mobile - Code snippet for patching UnityLoader.compatibilityCheck() so it won't show popup message on mobile. Works in Unity 2018 and 2019. Unity 2020 switched templates and don't need it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UnityLoader.compatibilityCheck = function (unityInstance, onsuccess, onerror) { | |
if (!UnityLoader.SystemInfo.hasWebGL) { | |
unityInstance.popup('Your browser does not support WebGL', | |
[{text: 'OK', callback: onerror}]); | |
} else { | |
onsuccess(); | |
} | |
} | |
// now you can call ... var unityInstance = UnityLoader.instantiate( ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment