TwitchLib / TwitchLib.Unity

TwitchLib repository representing all code belonging to the implementation of TwitchLib for Unity. Maintained primarily by LuckyNoS7evin.
164 stars 33 forks source link

Unity stops listening to chat commands #51

Open thmsndk opened 4 years ago

thmsndk commented 4 years ago

Unity Version: 2019.2.5f1 Running with release 1.0.0 of twitchlib.unity in the standalone player i'm experiencing issues with the chat commands, the first few seconds after connecting it responds to commands written in chat. e.g. !commands or !help and the likes.

The bot appears to be connected to the chat, and can send messages to it, but it seems like the client.OnChatCommandReceived event is no longer fireing. as if the client loses the subscriptions for the event?

swiftyspiffy commented 4 years ago

Hi. Sorry about the delay.

You might try setting the client protocol to TCP, this has been used several times to resolve the apparent disconnect after several seconds of being connected correctly:

client = new TwitchClient(protocol: TwitchLib.Client.Enums.ClientProtocol.TCP);
thmsndk commented 4 years ago

@swiftyspiffy hmm the Client i'm initializing does not take any parameters, and is called Client

e.g.

client = new Client();
client.Initialize(credentials, channel_name);

Am I supposed to download the repository and build the code myself instead of using the latest release? I followed a guide where I downloaded the compiled .dll from the release page and included in unity.

swiftyspiffy commented 4 years ago

The highest number isn't the most recent version, I don't think (the CI is broken and publishing incorrect versions). It might be worth it to just clone the repo and build the dev branch to get the latest code. I think the above code snippet should fix your problem.

thmsndk commented 4 years ago

@swiftyspiffy I cloned the master branch and built it, without any code changes, seems to be stable so far. but i'd have to do some more testing.

The Client class from TwitchLib.Unity has no constructor though :) so it is not possible to set thoose parameters as far as I can tell.

supersessie commented 4 years ago

Any chance of uploading a .dll file? I am having the same issue right now and I can't get the project to build...

Lock-The-Door commented 4 years ago

Recently I've managed to get the built version working by using .NET 4.8+ with the current dlls