This is a lightweight and efficient Twitch.tv IRC client for Unity.
In short, this allows you to integrate Twitch Chat to your Unity projects.
The primary goal is to be able to read and send chat messages as efficiently as possible.
- Reading and sending chat messages
- Parsing Twitch emotes and badges
- Optional anonymous login
- Automatic ratelimit checks
- Name color normalization (similar to native Twitch chat)
- Special messages (whispers, sub/resub, raids, first time viewers, etc)
- Bits cheering, channel points, predictions, etc
- Moderation (ban, timeout, etc)
- Third party extensions (FFZ, BTTV, 7TV, etc)
- and more...
- WebGL builds are not supported
- Open Unity Package Manager (Window -> Package Manager)
- Click the
+button in the top left corner - Select
Add package from git URL... - Copy and paste the following URL and finish by clicking
Add
https://github.com/lexonegit/Unity-Twitch-Chat.git?path=/Unity-Twitch-Chat/Assets/Package
- Install the Unity package (see above)
- Create a new empty GameObject and add the
Twitch IRCcomponent. - In the inspector, set your Twitch details (OAuth, username, channel)
- You can generate an OAuth token at https://twitchapps.com/tmi/
- Alternatively you can enable
Use Anonymous Loginto use without OAuth
- Make sure
Connect IRC On StartandJoin Channel On Startare enabled and press play – You should now see JOIN messages, etc. in the console. - Create a new script that has a listener for the
IRC.OnChatMessageevent.- See ListenerExample.cs for reference.
- The listener will receive
Chatterobjects which contain information about each chat message, such as the chatter name, message, emotes, etc...
Having issues? Check out the included ExampleProject for a better understanding.
Spawn chatters as jumping boxes. Box color is based on their primary badge.
voidConnect() - Connects to Twitch IRCvoidDisconnect() - Disconnects from Twitch IRCvoidSendChatMessage(string message) - Sends a chat message to the channelvoidJoinChannel(string channel) - Join a Twitch channelvoidLeaveChannel(string channel) - Leave a Twitch channelvoidPing() - Sends a PING message to the Twitch IRC servereventOnChatMessage - Event that is invoked when a chat message is receivedeventOnConnectionAlert - Event that is invoked when a connection alert is receivedIRCTagsClientUserTags - Returns the tags of the client user (badges, name color, etc)
ColorGetNameColor() - Returns the color of the chatter's nameboolIsDisplayNameFontSafe() - Returns true if displayName is "font-safe" meaning that it only contains characters: a-z, A-Z, 0-9, _boolContainsEmote(string emoteId) - Returns true if the chatter's message contains the specified emote (by id)boolHasBadge(string badgeName) - Returns true if the chatter has the specified badge
Intro Fighters, stream overlay game https://lexone.itch.io/introfighters
Did you make something cool? Contact me (lexone on Discord) to get featured here!

