From 674f6c7b8344572f72f0e3bc26a8fb46df9282ec Mon Sep 17 00:00:00 2001 From: psygames
Date: Mon, 4 Sep 2023 20:06:02 +0800 Subject: [PATCH 1/2] readme supprot package manager --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fb3c312..54a07e2 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,13 @@ ### **安装方法** - - 在 [Releases](https://github.com/psygames/UnityWebSocket/releases) 页面中,下载最新版本的 `UnityWebSocket.unitypackage` 安装包,然后导入到您的项目中。 +- **通过 Unity Package 安装** + 在 [Releases](https://github.com/psygames/UnityWebSocket/releases) 页面中,下载最新版本的 `UnityWebSocket.unitypackage` 安装包,然后导入到您的项目中。 + +- **通过 Package Manager 安装** + + 在 Unity 菜单栏中打开 `Window/Package Manager`,点击左上角 `+` 号,选择 `Add package from git URL...` ,输入 `https://github.com/psygames/UnityWebSocket.git#upm` 并确认。 ### **使用方法** From d5573240f20d86d2e2117bf8b6b5465a8a7d6437 Mon Sep 17 00:00:00 2001 From: psygames
Date: Tue, 27 Aug 2024 21:49:57 +0800
Subject: [PATCH 2/2] [v2.81][bugfix] replace task.yield to thead.sleep(1), fix
cpu 100% cost
---
Assets/UnityWebSocket/Scripts/Runtime/Core/Settings.cs | 2 +-
.../Scripts/Runtime/Implementation/NoWebGL/WebSocket.cs | 7 +++----
ProjectSettings/ProjectSettings.asset | 2 +-
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/Assets/UnityWebSocket/Scripts/Runtime/Core/Settings.cs b/Assets/UnityWebSocket/Scripts/Runtime/Core/Settings.cs
index d6c8d57..227daa6 100644
--- a/Assets/UnityWebSocket/Scripts/Runtime/Core/Settings.cs
+++ b/Assets/UnityWebSocket/Scripts/Runtime/Core/Settings.cs
@@ -7,6 +7,6 @@ public static class Settings
public const string QQ_GROUP_LINK = "https://qm.qq.com/cgi-bin/qm/qr?k=KcexYJ9aYwogFXbj2aN0XHH5b2G7ICmd";
public const string EMAIL = "799329256@qq.com";
public const string AUHTOR = "psygames";
- public const string VERSION = "2.8.0";
+ public const string VERSION = "2.8.1";
}
}
diff --git a/Assets/UnityWebSocket/Scripts/Runtime/Implementation/NoWebGL/WebSocket.cs b/Assets/UnityWebSocket/Scripts/Runtime/Implementation/NoWebGL/WebSocket.cs
index ef8ff92..7c389c1 100644
--- a/Assets/UnityWebSocket/Scripts/Runtime/Implementation/NoWebGL/WebSocket.cs
+++ b/Assets/UnityWebSocket/Scripts/Runtime/Implementation/NoWebGL/WebSocket.cs
@@ -166,14 +166,13 @@ private async void StartSendTask()
{
while (!closeProcessing)
{
- while (!closeProcessing && sendQueue.TryDequeue(out var buffer))
+ while (!closeProcessing && sendQueue.Count > 0 && sendQueue.TryDequeue(out var buffer))
{
Log($"Send, type: {buffer.type}, size: {buffer.data.Length}, queue left: {sendQueue.Count}");
await socket.SendAsync(new ArraySegment