```
chore(bridge): 删除桥接包的提交记录和Git属性配置 删除了 .codely-bridge-commit 文件中存储的提交哈希值 移除了 .gitattributes 文件中的行结束符配置规则 ```
This commit is contained in:
1 parent
d26d323912
commit
13d0c80335
392 files changed
+1814
-1895
No files matched your search
+58
@@ -0,0 +1,58 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace UnityTcp.Editor.Helpers
|
||||
{
|
||||
/// <summary>Restricts editor auto-start hooks to the main Editor process.</summary>
|
||||
public static class EditorProcessGuard
|
||||
{
|
||||
public static bool ShouldSkipEditorAutoStart()
|
||||
=> ShouldSkipEditorAutoStart(IsAssetImportWorkerProcess(), IsSecondaryEditorProcess());
|
||||
|
||||
public static bool ShouldSkipEditorUiAutoStart()
|
||||
=> ShouldSkipEditorUiAutoStart(
|
||||
IsAssetImportWorkerProcess(),
|
||||
IsSecondaryEditorProcess(),
|
||||
Application.isBatchMode,
|
||||
SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null);
|
||||
|
||||
internal static bool ShouldSkipEditorAutoStart(
|
||||
bool isAssetImportWorker,
|
||||
bool isSecondaryEditor)
|
||||
=> isAssetImportWorker || isSecondaryEditor;
|
||||
|
||||
internal static bool ShouldSkipEditorUiAutoStart(
|
||||
bool isAssetImportWorker,
|
||||
bool isSecondaryEditor,
|
||||
bool isBatchMode,
|
||||
bool isNullGraphics)
|
||||
=> ShouldSkipEditorAutoStart(isAssetImportWorker, isSecondaryEditor)
|
||||
|| isBatchMode
|
||||
|| isNullGraphics;
|
||||
|
||||
private static bool IsAssetImportWorkerProcess()
|
||||
{
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
return AssetDatabase.IsAssetImportWorkerProcess();
|
||||
#elif UNITY_2019_3_OR_NEWER
|
||||
return UnityEditor.Experimental.AssetDatabaseExperimental.IsAssetImportWorkerProcess();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
private static bool IsSecondaryEditorProcess()
|
||||
{
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
return UnityEditor.MPE.ProcessService.level == UnityEditor.MPE.ProcessLevel.Secondary;
|
||||
#elif UNITY_2020_2_OR_NEWER
|
||||
return UnityEditor.MPE.ProcessService.level == UnityEditor.MPE.ProcessLevel.Slave;
|
||||
#elif UNITY_2020_1_OR_NEWER
|
||||
return Unity.MPE.ProcessService.level == Unity.MPE.ProcessLevel.UMP_SLAVE;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user