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


    Unity Hot Reload 旧版本的报错

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

       PlayerSettings.suppressCommonWarnings; 找不到
    
    • 1

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

    代码片段:

    
            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();
                }
            }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36

    在旧的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();
                }
            }
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
  • 相关阅读:
    Multi-Party Threshold Private Set Intersection with Sublinear Communication-2021:解读
    Kotlin MVVM之Jetpack系列ViewModel、LiveData的简单使用
    自研ORM (匠心之作)
    探索自动化测试工具的威力
    TDengine 与煤科院五大系统实现兼容性互认,助力煤矿智能化安全体系搭建
    Sass语法小册-笔记迁移
    抽象轻松的java
    HTTPS 的加密流程的总结
    【环境配置】使用VMware配置Ubuntu虚拟机集群
    qsort 函数的使用及其模拟实现
  • 原文地址:https://blog.csdn.net/GoodCooking/article/details/134040513