Created
June 24, 2020 02:33
-
-
Save caphosra/887786a1d6aeaf070237579b95d64d4b to your computer and use it in GitHub Desktop.
Detele mobile warning dialog from Unity WebGL build
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
import pathlib | |
delete_func = "compatibilityCheck:function(e,t,r){UnityLoader.SystemInfo.hasWebGL?UnityLoader.SystemInfo.mobile?e.popup(\"Please note that Unity WebGL is not currently supported on mobiles. Press OK if you wish to continue anyway.\",[{text:\"OK\",callback:t}]):[\"Edge\",\"Firefox\",\"Chrome\",\"Safari\"].indexOf(UnityLoader.SystemInfo.browser)==-1?e.popup(\"Please note that your browser is not currently supported for this Unity WebGL content. Press OK if you wish to continue anyway.\",[{text:\"OK\",callback:t}]):t():e.popup(\"Your browser does not support WebGL\",[{text:\"OK\",callback:r}])}" | |
expected_func = "compatibilityCheck:function(e,t,r){r();}" | |
def main(): | |
path = input("Input the directory path of UnityLoader.js > ") | |
path = str(pathlib.Path(path).joinpath("UnityLoader.js")) | |
script = "" | |
with open(path, "r") as fs: | |
script = fs.read() | |
script = script.replace(delete_func, expected_func) | |
with open(path, "w") as fs: | |
fs.write(script) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reference: https://answers.unity.com/questions/1339261/unity-webgl-disable-mobile-warning.html