当前位置: 首页 > article >正文

使用Unity旧版本使用hotReload在开始的时候提示 PlayerSettings.suppressCommonWarnings; 找不到

Unity Hot Reload 旧版本的报错

使用Unity旧版本使用hotReload在开始的时候提示

   PlayerSettings.suppressCommonWarnings; 找不到

按照下面的方式修改完毕后可以正常使用
在添加热更新之前请备份。

代码片段:


        public async Task Sync() {
            await ThreadUtility.SwitchToThreadPool();
            var config = LoadConfig();
            if (config.useBuiltInProjectGeneration) {
                return;
            }
            
            await ThreadUtility.SwitchToMainThread();
            await gate.WaitAsync();
            try {
                //Cache all data that is accessed via unity API on the unity main thread.
                m_AllAssetPaths = AssetDatabase.GetAllAssetPaths();
                m_ProjectSupportedExtensions = EditorSettings.projectGenerationUserExtensions;
                m_EngineAssemblyPath = InternalEditorUtility.GetEngineAssemblyPath();
                m_EditorAssemblyPath = InternalEditorUtility.GetEditorAssemblyPath();
                m_FallbackRootNamespace = EditorSettings.projectGenerationRootNamespace;
                m_SuppressCommonWarnings = 
                 #if UNITY_2020_1_OR_NEWER
                     PlayerSettings.suppressCommonWarnings;
                #else
                      false;
                #endif

                //Do the remaining work on a separate thread
                await Task.WhenAll(
                    BuildPackageInfoCache(),
                    BuildEditorAssemblies(),
                    BuildPostProcessors()
                );
                await GenerateAndWriteSolutionAndProjects(config);
            } finally {
                gate.Release();
            }
        }

在旧的IDE中会提示PlayerSettings.suppressCommonWarnings;找不到,
修改方式是,注释宏命令,将m_SuppressCommonWarnings设置为false

        public async Task Sync() {
            await ThreadUtility.SwitchToThreadPool();
            var config = LoadConfig();
            if (config.useBuiltInProjectGeneration) {
                return;
            }
            
            await ThreadUtility.SwitchToMainThread();
            await gate.WaitAsync();
            try {
                //Cache all data that is accessed via unity API on the unity main thread.
                m_AllAssetPaths = AssetDatabase.GetAllAssetPaths();
                m_ProjectSupportedExtensions = EditorSettings.projectGenerationUserExtensions;
                m_EngineAssemblyPath = InternalEditorUtility.GetEngineAssemblyPath();
                m_EditorAssemblyPath = InternalEditorUtility.GetEditorAssemblyPath();
                m_FallbackRootNamespace = EditorSettings.projectGenerationRootNamespace;
                m_SuppressCommonWarnings = false;
               //  #if UNITY_2020_1_OR_NEWER
               //      PlayerSettings.suppressCommonWarnings;
               // #else
               //       false;
              //#endif

                //Do the remaining work on a separate thread
                await Task.WhenAll(
                    BuildPackageInfoCache(),
                    BuildEditorAssemblies(),
                    BuildPostProcessors()
                );
                await GenerateAndWriteSolutionAndProjects(config);
            } finally {
                gate.Release();
            }
        }


http://www.kler.cn/a/104542.html

相关文章:

  • DDOS版-超功能记事本 Ⅲ 8.8源码
  • 文献阅读(207)FPGA HBM
  • Fedora Linux 38下安装音频与视频的解码器和播放器
  • 第八章 软件测试自动化
  • python 动态加载C# 动态库的一些问题
  • css3 3D 转换 技巧详细解析与代码实例
  • Java连接redis报错timed out问题解决
  • linux安装gitlab-runner最新保姆级教程
  • 大数据-Storm流式框架(三)--Storm搭建教程
  • 【Django restframework】django跨域问题,解决PUT/PATCH/DELETE用ajax请求无法提交数据的问题
  • 鼠标移入移出修改滚动条的默认样式
  • Kafka磁盘写满日志清理操作
  • python自动化测试(二):xpath获取元素
  • 打印机连接网络后怎么安装驱动?
  • centos Let‘s Encrypt 免费https证书申请,并且自动续约
  • Docker:创建主从复制的Redis集群
  • OpenCV #以图搜图:感知哈希算法(Perceptual hash algorithm)的原理与实验
  • 二叉搜索树的实现
  • 外汇天眼:获利数倍、财务自由不是梦? 小心网络投资诈骗4阶段!
  • 文件加密丨最值得收藏的3种方法