Hotrian / OpenVRTwitchChat

Put your favorite Twitch Chat directly into any OpenVR game!
Other
173 stars 50 forks source link

Twitch Emotes are buggy, sometimes cause exceptions #11

Open Hotrian opened 8 years ago

Hotrian commented 8 years ago

This seems to be related to Unity's TextMesh Quads, but I haven't been able to pin down the exact error. Sometimes when setting the TextMesh.text, Unity will throw an error related to setting an index outside of the vertex array, but I'm not setting any indices, Unity does it itself, indicating Unity is somehow failing to set the correct indices, possibly due to race conditions.

As a result, the Release will sometimes crash when handling the Emotes, but for some reason this doesn't seem to occur at all in the Editor, so it's pretty difficult to pin down the exact error. Because of this, Emote support is still pretty experimental and I'm being forced to release in Development mode so that exceptions are caught instead of crashing the program. I tried to use some try {} catches, but it doesn't seem to have helped any, so I suspect Unity is actually updating these on a delayed call, and I might have to synchronize with it if possible.

Once the buggy lines go away, the chat continues on as normal in the Development version, so although you might sometimes miss a few lines of chat, this only seems to be happening in pretty busy chat rooms, so I don't think it will effect smaller streamers (or should at least effect them significantly less).

Hotrian commented 8 years ago

Another bug is that it seems I derped the materials; When an emote is used at the start of the next line, it accidentally removes the material from the last set(?), even if it is actually being used there. I haven't extensively tested this but I'm noting this so I don't forget about it. See:

example

I'll figure out what causes this and fix it when I have a chance.

At one point I was getting a bunch of these babies:

example2

But it's possible I've since fixed this issue, but if anyone knows exactly what this means it would be great if you could share.

But mostly the crashing seems to be caused by

Failed setting triangles. Some indices are referencing out of bounds vertices. IndexCount: 246, VertexCount: 920

in

UnityEngine.TextMesh:set_text (string)

So I'm not sure exactly what I'm doing wrong.

Hotrian commented 8 years ago

The Repo is now using Unity 5.3.6f1 and I'm no longer seeing the issues in the last comment, though emotes are still a bit buggy :).