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

URP Outline and Default Alignment

A topic by EnveegeeGames created Mar 16, 2023 Views: 172 Replies: 2
Viewing posts 1 to 3
(1 edit)

Hello,

Apologies if these questions have been answered, I tried searching for a while but could only find old threads.

I saw in the documentation that outline/dropshadow don't work in URP, however, I was using UI Outline for a bit and it worked 95% of the time. I ran into issues with it not showing up correctly in play mode which is what led me to the documentation.

I was just wondering if the docs were out of date, and if outline worked correctly in builds? Can I ignore issues in play mode perhaps? Outline for 3D text didn't work at all, so I'm thinking that one's a no go.


I was also wondering if there was a way to have text be aligned to the center of the bounding box by default. Currently, it's always touching the lower edge of the bounding box, and I have to manually adjust it for just about everything. I realize this is nitpicky, but I get bothered thinking whether or not the values I entered are actually centered.

Any tips for this?

Thank you.

Developer

Hello,

Yeah, the outline shaders currently aren't supported in-editor for URP/HDRP. I've heard reports of them rendering fine in built games, but that'd still make development hard. I wrote this script that emulates the outline effect and works in URP: https://pastebin.com/wWv49mgG So try placing this on the STM object you want to have an outline.


A new outline shader that looks better than the current one and works in URP is (still!) in the works by a third party. I ask for a bit more patience on the completion of that.

---

Text lining up with the bounding box is what the "baseOffset" feature is meant for! So you can tweak that offset per-mesh to centre text. I'd do it automatically, but the bounding box is already created based on font bounds, so there's no real way for me to figure out how to nicely space stuff, so I think the baseOffset feature is a good solution.

Regarding this, I actually wrote a script for applying settings like this to multiple STM objects at the same time, called "STMPresets". So... you just have to change the data on one scriptableObject, and all STM objects referencing that SO will update automatically to match the new settings. So you can say... "Font: arial BaseOffset: x=0, y=0.4", and that will just be applied to all meshes listening to that preset. It's been working well in a personal project of mine, so I might include it as a utility script in the next version of STM? If you think this would help with having to manually adjust text, I could upload an early version to pastebin for you!

(1 edit)

Thanks for the reply!

I'll be sure to check out that outline script, anything that works is good with me :)

I've been using Base Offset to center my text, but I'm just a bit ocd when it comes to this stuff haha. I'm terrible at eyeballing things, and I keep getting the feeling that it's off center. TMP defaults in a nice centered position, so I wondered if I could get similar default behavior with STM, but the Base Offset is more than good enough. Just to calm my compulsions a bit, I've also overlaid some TMP text over the STM text for the purposes of centering it perfectly (then deleting the TMP). I realize this is a bit insane, but I digress.

Thanks for the script offer, but that's a bit overkill for my purposes. Working with STM in code is also really easy, so I'm sure I could come up with something if I really needed to.

Once again, thanks for the quick reply.

Amazing asset :)