当前位置:网站首页>Unity WebGL移动端去除警告
Unity WebGL移动端去除警告
2022-06-28 12:20:00 【奇大可】
修改Build\UnityLoader.js。
把下面代码替换成false
UnityLoader.SystemInfo.mobile //替换成false
["Edge", "Firefox", "Chrome", "Safari"].indexOf(UnityLoader.SystemInfo.browser) == -1 //替换成false为了避免每次构建时都需要手动更改,使用PostBuildHandler脚本。Editor下创建PostBuildHandler脚本
using System;
using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
public class PostBuildHandler
{
[PostProcessBuild]
public static void OnPostProcessBuild(BuildTarget target, string targetPath)
{
if (target != BuildTarget.WebGL) return;
var path = Path.Combine(targetPath, "Build/UnityLoader.js");
var text = File.ReadAllText(path);
text = text.Replace("UnityLoader.SystemInfo.mobile", "false");
text = text.Replace("[\"Edge\",\"Firefox\",\"Chrome\",\"Safari\"].indexOf(UnityLoader.SystemInfo.browser)==-1", "false");//注意字符串中的空格
File.WriteAllText(path, text);
}
}边栏推荐
- 搭建学习环境
- 【Unity编辑器扩展基础】、GUILayout
- Three ways to implement LRU cache (recommended Collection)
- pwn入门(1)二进制基础
- KDD 2022 | graph neural network generalization framework under the paradigm of "pre training, prompting and fine tuning"
- fatal: unsafe repository (‘/home/anji/gopath/src/gateway‘ is owned by someone else)
- 登录接口存取token,清除token
- [vi/vim] basic usage and command summary
- Map排序工具类
- Pyqt5 visual development
猜你喜欢

Ugui force refresh of layout components
![[C language] three sorting methods for random number files](/img/a5/363133a0c85aa43c6cd8287e479f71.jpg)
[C language] three sorting methods for random number files
![[C language] about scanf() and scanf_ Some problems of s()](/img/d1/e3d0b845e699c8c1fe3eb9f3b250e1.png)
[C language] about scanf() and scanf_ Some problems of s()

RemoteViews布局和类型限制源码分析

【C语言】NextDay问题

UGUI使用小技巧(六)Unity实现字符串竖行显示

已知两个点和中间一个比例的点,求该点坐标

ASP.NET CORE Study04

Tips for using ugui (V) using scroll rect component

【Unity编辑器扩展实践】、利用txt模板动态生成UI代码
随机推荐
UGUI强制刷新Layout(布局)组件
websocket 1 分钟自动断开连接
Zero basic C language (I)
UGUI使用小技巧(六)Unity实现字符串竖行显示
ASP.NET CORE Study06
Unity Editor Extension Foundation, GUI
SHA256加密工具类
自定义标题栏View
Three ways to implement LRU cache (recommended Collection)
【C语言】如何产生正态分布或高斯分布随机数
Usage and principle of precomputedtextcompat
Url追加参数方法,考虑#、?、$的情况
PyQt5可视化开发
【C语言】结构体嵌套二级指针的使用
RemoteViews的作用及原理
Unity加载设置:Application.backgroundLoadingPriority
杰理之wif 干扰蓝牙【篇】
2022招商FinTech比赛总结
【Unity编辑器扩展基础】、GUI
【vi/vim】基本使用及命令汇总