Skip to content

Commit 164af61

Browse files
committed
使用更简单的方式修复Unity运行时触发代码编译导致卡死问题
1 parent a4a6a89 commit 164af61

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

Assets/UnityWebSocket/Scripts/Runtime/Core/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ public static class Settings
77
public const string QQ_GROUP_LINK = "https://qm.qq.com/cgi-bin/qm/qr?k=KcexYJ9aYwogFXbj2aN0XHH5b2G7ICmd";
88
public const string EMAIL = "[email protected]";
99
public const string AUHTOR = "psygames";
10-
public const string VERSION = "2.8.4";
10+
public const string VERSION = "2.8.5";
1111
}
1212
}

Assets/UnityWebSocket/Scripts/Runtime/Implementation/NoWebGL/WebSocketManager.cs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ public static void CreateInstance()
3030
if (!go) go = new GameObject(rootName);
3131
_instance = go.GetComponent<WebSocketManager>();
3232
if (!_instance) _instance = go.AddComponent<WebSocketManager>();
33-
#if UNITY_EDITOR && UNITY_2019_1_OR_NEWER
34-
UnityEditor.Compilation.CompilationPipeline.compilationStarted -= OnCompilationStarted;
35-
UnityEditor.Compilation.CompilationPipeline.compilationStarted += OnCompilationStarted;
36-
#endif
3733
}
3834

3935
private readonly List<WebSocket> sockets = new List<WebSocket>();
@@ -60,17 +56,7 @@ private void Update()
6056
}
6157

6258
#if UNITY_EDITOR
63-
#if UNITY_2019_1_OR_NEWER
64-
private static void OnCompilationStarted(object obj)
65-
{
66-
if (_instance != null)
67-
{
68-
_instance.SocketAbort();
69-
}
70-
}
71-
#endif
72-
73-
private void OnApplicationQuit()
59+
private void OnDisable()
7460
{
7561
SocketAbort();
7662
}

0 commit comments

Comments
 (0)