Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[solved] SuperTextMesh.reading doesn't seem to work correctly?

A topic by slimefriend created Mar 09, 2019 Views: 586 Replies: 7
Viewing posts 1 to 5
(2 edits)

Hey Kai!

I'm trying to use textMesh.reading to queue up a bunch of messages and play them one after the other.

But with this code, it looks like both messages are being read really fast (or just appearing immediately) and then disappearing. 

Would you know why that's happening?

EDIT: I should mention, this code is running in an Update function.  At some point I'm going to add some buffer between reading out the messages, but for now I want to get the basic stuff working.

if (!textMesh.reading) {
      if (messages.Count > 0) {
        var message = messages[0];
        textMesh.text = message.msg;
        textMesh.Rebuild();
        pestoImage.sprite = pestoSpriteDict[message.emote];
        messages.RemoveAt(0);
      }
    }
Developer (1 edit)

What is the current draw animation attached to your mesh? It's possible that reading is being set to false early because the animation takes time to complete even if the reading loop is done... I think. It's also possible that this code is being called before STM has begun reading, which would also cause "reading: to be false.


 Either way, personally I'd use STM's on complete event for this instead! That way you don't need to check the state of the mesh every frame.

Hey,

So I tried moving that aforementioned code into an oncomplete event listener, and I get the same result.  It's really strange.

Whoa I found something even weirder.  I built and ran the game on a whim and it worked as-expected there.  Seems like running it in the editor breaks it somehow?

Developer

Hmm... if there's a split between how it works in-editor vs in-build, then it might have something to do with the Update()/OnValidate() cycle?


I tried running your code myself, and the strangest thing is, it works perfectly fine for me in-editor? What version of Unity are you using, and are you using the latest version of STM?

Hey!

I'm using Unity 2018.3.6f1.

I wasn't using the most up to date Super Text Mesh, but I just updated it and got the same result.

Developer

Can you email me a sample project? Since I'm unable to reproduce the bug, I think I'll need that to fix it.

Developer

Just an update, we handled this though email, and the issue was Unity's startup lag. (Pressing play in-editor will skip the first few seconds of a game) The dialogue was set up to advance automatically & quickly under Start(), so it looked like it was skipping to the end.