• 使用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
  • 相关阅读:
    影响MySQL索引B+树高度的是什么?
    C++智能指针
    美食推荐网站设计
    人脸106和240点位检测解决方案
    第一个AI应用(文心智能体平台)
    用RocketMQ这么久,才知道消息可以这样玩
    多玩家“角力”会议平板
    Centos - openldap
    设计模式Java实战
    paddle 42 将任意paddleclas模型作为paddledetection中的backbone使用
  • 原文地址:https://blog.csdn.net/GoodCooking/article/details/134040513