使用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();
}
}