Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

[solved] A few 🐞bugs and ❓questions

A topic by Alexander Ocias created Sep 27, 2017 Views: 1,599 Replies: 14
Viewing posts 1 to 14
(1 edit)

Hey Kai, just picked up Super Text Mesh, and it's fantastic! Would you please help me out with a few things though? (I'm on Unity 5.6.3p3 on masOS 10.13, using STM 1.5.2)

1. Bug? When read delay is set below 0.05, audio clips play straight through delays, same result with "Stop previous sound" checked (and also the reading seems to stutter at points, related to delay interpretation?) Video example with read delay 0.01:

2. Bug? I wanted to make periods excluded from audio, but clicking "Create New Auto Clip" doesn't seem to work...

 

3. Question! My goal is to set up my dialogue boxes to function somewhat like in Earthbound/Mother 3, where when more text gets appended, and old text moves out of the box line by line as more space is needed, see:


I was planning on doing this by getting the height of the number of visible lines, moving the STM object up, combined with masking out the old lines... but STM doesn't seem to work with masks for me, and I can't figure out how to get the height of currently visible lines... Any ideas? (It would be neat if there was an option to make "Line Count Limit" do this automatically, actually!)

4. Question! Related to the above, regarding alignment of multi-line text relative to bullet points. I was previously achieving this with TextMesh Pro using "•<indent=4em>This is some multi-line text that aligns a left margin nicely</indent>", any suggestions about how to go about this in STM? (hmm... if I could get the visible line count as mentioned above, I could manually instantiate some bullet images...)

Developer

Hey!

These are very good bugs, lemme go at em one at a time

1. This one's weird... Maybe the audio script isn't keeping up with the actual read out script...? maybe the indexes are getting mixed up? I'll give it a look tomorrow, it's gotta be some weird timing oversight in the Read function. I changed some code there recently, so I might have broken something.

2. I probably have some field labeled incorrectly, or it's not refreshing the inspector like it should? For now, create in assets folder, click "ping" while your assets folder is up to go to the autoclips, and duplicate one by hand. Click "refresh database" in the STM inspector to update it.

3. THAT'S!!! a really good idea! this should probably be the default behaviour, but I wouldn't be able to have it be animated when it scrolls up like that. I'll try to figure out how to add this to the Read function, cause it really should do this. It might also be possible for me to do w/ vertex modification, since I can use that to change what vertices are visible as a mesh is being read out. For now, I could try modifying the shader to use the stencil buffer, or try the included UI Masked shader and see if that works? It's an old shader, and sorta hacky so it might not work. 

I dont think the value for the current line being shown is an exposed one, but I could be wrong? It'd be somewhere int he code near the "lineCountLimit" variable, since those need to interact. The current y position of a letter might also be useful for this?

4. If I were to add a tag that let you set an additional offset for text, would that work? Something like... <o=-1> to offset the next letter by 1 unit to the left? For now, try making a quad (Inline image) to use as a bullet point since you can set an offset for those already. That's the best quickfix I can think of. I think and indent function could be done tho, I'd just have to have the mesh remember the offset, and start new rows from there... I think it'll be doable, so I'll probably add that!

It's already pretty late here, so I'll look into this more tomorrow! Some of these things I typed are also notes to myself, so sorry this response is a little free-form!

1. Ok.

2. Yep, great, got it.

3. Sweet. (Is there an event or something to subscribe to to get the current letter y on every read advance?)

4. Great, yeah, the quad offset works well... except quads don't seem to draw on STM UI objects, only on Super 3D Text? Another 🐞?

Developer

Ah right, quads won't draw on Unity UI in Unity versions older than 2017.1, since it'd cause a nasty crash before that, sorry about that!

There's no event to subscribe to yet, I think only the index of the current letter being read out is exposed. The value could be exposed, but it would just be an integer of the current line. Another way this could work is that... STM puts a line break character (\n) at the end of each row, so that could potentially be used, too? I'm trying to think of the most user-friendly way to fix this...

Working on other fixes now!

Developer

Alright, working on the first bug.  I was able to recreate it by having a very long string, then a delay, and more text after.

STM is supposed to only be able to play a sound in the reading out loop if the latest letter being read is a different one than the last frame, so... ok got it.

The issue is that every frame the mesh is updated, it'll say "the last letter that was read was X", so it'll only play the sound of the latest letter that was read. So the issue is caused by the mesh moving so fast, the last letter that was read could be... 40, and the delay is at 80 and lasts 1 second, so the mesh will try to play the sound for everything between 40 and 80 as it catches up.

On line 1127, replace the if statement with this one:


if(myAnimPos > 0f && !undrawingMesh && i > latestNumber){
    DoEvent(i); //do every event up to this integer
    if(!playedSoundThisFrame){
        PlaySound(i); //only play one sound this frame, from the first letter drawn this frame
    }
    latestNumber = Mathf.Max(latestNumber, i); //find latest number to start from next frame
}


The variable "playedSoundThisFrame" replaces "foundLatestNumber", so change the name of the boolean on line 1111, too.

Developer

Fixed #2, forgot to rename a field from ages ago. On line 288 of SuperTextMesh.cs, change "STMClipData" to "STMAutoClipData".

Developer

#3 is in! Mother 3 style dialogue boxes are something I really can't believe I forgot.


It'll be out in the next update, which is hopefully soon if I can get the <indent> tag in shortly!

This is great! I was wondering how to do something like this myself for another project. Thanks for putting in the work for us.

Developer

Also, there's an exposed variable named "lowestLine" now, which holds the latest line drawn by STM. So if you don't like the scrolling effect I did, that can be used to create your own!

(1 edit)

Kai... mate... legendary!

I'll dig right into this stuff this weekend+/when the next update is out!

Developer

#4 done, indents are in!

The float value determines the indent in localspace, so resizing the text keeps the indent at the same spot. I wanted it to be just an "<indent>" tag that sets the indent to be at the letter it was typed at, but all my autowrap code takes place before my positional data I'd need, so I'd have to redo that section to get it working that way. But I think this should be a good fix for now!


I'll publish the update soon, but I want to see if I can get one or two other features working first, since this will be a new version number. Drop me an email and I'll send you a build of what I currently have if you want, though!

Developer

Published it! On itch already and should be on the asset store shortly.

Hmmm looks like there's a bug with the new line limiter. It takes effect one frame too late (causing a nasty flicker)!


Developer

Hey, working on it now, just figured out the cause. The offset is being applied before the lowest line is calculated. Just gotta figure out a way around this

Developer

Published a fix, hopefully it all works good, I'm supposed to be heading to sleep r/n