chore(bridge): 删除桥接包的提交记录和Git属性配置 删除了 .codely-bridge-commit 文件中存储的提交哈希值 移除了 .gitattributes 文件中的行结束符配置规则 ```
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
|
|
namespace UnityTcp.Editor.Helpers
|
|
{
|
|
/// <summary>
|
|
/// Restricts bridge auto-start to the main Editor process and supported automation runs.
|
|
/// Set <see cref="AllowBridgeInBatchEnvVar"/> to opt in when integration tests need the bridge.
|
|
/// </summary>
|
|
internal static class EditorAutomationGuard
|
|
{
|
|
internal const string AllowBridgeInBatchEnvVar = "UNITY_TCP_ALLOW_BATCH";
|
|
|
|
internal static bool IsAutomatedEditorRun()
|
|
=> Application.isBatchMode
|
|
|| SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null;
|
|
|
|
internal static bool ShouldSkipBridgeAutoStart()
|
|
=> EditorProcessGuard.ShouldSkipEditorAutoStart()
|
|
|| (IsAutomatedEditorRun()
|
|
&& string.IsNullOrWhiteSpace(
|
|
Environment.GetEnvironmentVariable(AllowBridgeInBatchEnvVar)));
|
|
|
|
internal static bool ShouldSkipBridgeAutoStart(
|
|
bool isAssetImportWorker,
|
|
bool isSecondaryEditor,
|
|
bool isAutomatedEditorRun,
|
|
bool allowBridgeInBatch)
|
|
=> isAssetImportWorker
|
|
|| isSecondaryEditor
|
|
|| (isAutomatedEditorRun && !allowBridgeInBatch);
|
|
}
|
|
}
|