Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[solved, change default in future update?] Solid outline support for gradients?

A topic by mrtenda created Nov 21, 2018 Views: 334 Replies: 3
Viewing posts 1 to 4
(4 edits)

Hey, I'm working on a feature for my game where messages like "Excellent!" or "Amazing!" will appear when the player achieves a combo of a certain length:



I'd really like to use a gradient (or, ideally, a texture) for this text. STM's gradient and texture features seem like they would be perfectly suited for this, but I also want the text to appear by fading in and disappear by fading out. Unfortunately, I can't seem to find a way to achieve this with text that's using a gradient or a texture. Is this something that's currently possible at all?
(EDIT: Nevermind, realized I could use a Draw Animation to make the text fade in! Sorry, ignore this part)

For textured text, I noticed that displaying it with an outline results in the outline taking on the same texture as the text itself. While this could potentially be desirable for some situations, I'm wondering if there's a way to display textured text with, for example, a solid white outline?

Thank you!

Developer

Hey!


Yeah, the outline shader takes on the texture of the text at the moment, it's honestly a feature I haven't used myself so I might change it to what you want, or make it a toggle-able option for the uber shaders. If you go into "STMoutline.cginc" and change the lines


col.rgb = mask.rgb * i.color.rgb; 
col.a = text.a * mask.a * i.color.a;


to


col.rgb = i.color.rgb; 
col.a = text.a * i.color.a;


That should do it, I think! You might have to right click STMoutline.cginc within unity and select "ReImport" to see the change take effect.


Developer

Also, your request about fading in/out text is totally valid. I added the "All At Once" read order option for this case, but it seems a bit hacky in practice. A friend asked me recently if you can control STM's colour with unity's animator, and I'd like to make it work that way, sometime. (Right now, Rebuild() would need to be called every frame the color is set) This wouldn't work with gradients anyway though, I'd have to add additive/multiplicative gradients, another feature I was debating on for a bit. (Would require a re-write of STM's colour system)


If you haven't figured it out, you can use the Unread() function to make text use a draw animation in reverse, too! Under "functionality" in STM's inspector, you can customize which animation is used.

Thank you for the super fast and helpful response, I modified STMoutline.cginc as you suggested and it worked! And yeah I feel like this is the functionality most people would want with textures and outlines, so making it the default behavior or an option at least seems like a good idea to me.

As for the fading stuff, yeah originally I was going to try to use Unity's animation stuff to fade the text, but after I discovered the "All At Once" option and Unread(), I was able to use those to achieve the effect I wanted to. So for me, fading works fine as it is now!