diff --git a/Unity-Twitch-Chat/Assets/ExampleProject/Scenes/ExampleScene.unity b/Unity-Twitch-Chat/Assets/ExampleProject/Scenes/ExampleScene.unity
index b400963..1a93435 100644
--- a/Unity-Twitch-Chat/Assets/ExampleProject/Scenes/ExampleScene.unity
+++ b/Unity-Twitch-Chat/Assets/ExampleProject/Scenes/ExampleScene.unity
@@ -773,7 +773,7 @@ MonoBehaviour:
showThreadDebug: 1
useRandomColorForUndefined: 1
readInterval: 50
- readBufferSize: 1024
+ readBufferSize: 256
writeInterval: 50
--- !u!4 &1312367230
Transform:
diff --git a/Unity-Twitch-Chat/Assets/Package/Runtime/IRC.cs b/Unity-Twitch-Chat/Assets/Package/Runtime/IRC.cs
index 1d95779..f4fd5e5 100644
--- a/Unity-Twitch-Chat/Assets/Package/Runtime/IRC.cs
+++ b/Unity-Twitch-Chat/Assets/Package/Runtime/IRC.cs
@@ -48,15 +48,15 @@ public partial class IRC : MonoBehaviour
[Tooltip("The number of milliseconds between each time the read thread checks for new messages.")]
[SerializeField] public int readInterval = 50;
- [Tooltip("The capacity of the read buffer. Smaller values consume less memory but require more cycles to retrieve data.")]
- [SerializeField] public int readBufferSize = 1024;
+ [Tooltip("The capacity of the read buffer. Smaller values consume less memory but require more cycles to retrieve data (CPU usage)")]
+ [SerializeField] public ReadBufferSize readBufferSize = ReadBufferSize._256;
[Header("Chat write settings (write thread)")]
[Tooltip("The number of milliseconds between each time the write thread checks its queues.")]
public int writeInterval = 50;
-
+
// If the game is paused for a significant amount of time and then unpaused,
// there could be a lot of data to handle, which could cause lag spikes.
// To prevent this, we limit the amount of data handled per frame.
@@ -301,7 +301,7 @@ public void SendChatMessage(string message)
/// Join a new channel
///
/// The channel to join
- public void JoinChannel(string channel)
+ public void JoinChannel(string channel)
{
if (channel != "")
connection.SendCommand("JOIN #" + channel.ToLower(), true);
@@ -311,7 +311,7 @@ public void JoinChannel(string channel)
/// Leaves a channel
///
/// The channel to leave
- public void LeaveChannel(string channel)
+ public void LeaveChannel(string channel)
{
if (channel != "")
connection.SendCommand("PART #" + channel.ToLower(), true);
diff --git a/Unity-Twitch-Chat/Assets/Package/Runtime/TwitchConnection.cs b/Unity-Twitch-Chat/Assets/Package/Runtime/TwitchConnection.cs
index e3f7f00..e241869 100644
--- a/Unity-Twitch-Chat/Assets/Package/Runtime/TwitchConnection.cs
+++ b/Unity-Twitch-Chat/Assets/Package/Runtime/TwitchConnection.cs
@@ -23,7 +23,7 @@ public TwitchConnection(IRC irc)
this.nick = irc.username;
this.channel = irc.channel;
- this.readBufferSize = irc.readBufferSize;
+ this.readBufferSize = (int)irc.readBufferSize; // Parse enum value
this.readInterval = irc.readInterval;
this.writeInterval = irc.writeInterval;
diff --git a/Unity-Twitch-Chat/Assets/Package/Runtime/Utils.cs b/Unity-Twitch-Chat/Assets/Package/Runtime/Utils.cs
index 80c5fe8..5aaa4a8 100644
--- a/Unity-Twitch-Chat/Assets/Package/Runtime/Utils.cs
+++ b/Unity-Twitch-Chat/Assets/Package/Runtime/Utils.cs
@@ -24,6 +24,19 @@ public enum IRCReply
NO_CONNECTION = 499,
}
+
+ public enum ReadBufferSize
+ {
+ _32 = 32,
+ _64 = 64,
+ _128 = 128,
+ _256 = 256,
+ _512 = 512,
+ _1024 = 1024,
+ _2048 = 2048,
+ _4096 = 4096,
+ }
+
public static class Tags
{
public static string read = "[IRC READ]";