Skip to main content

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

Layout issues like that can even stump experts, so it's a bit tough to debug this all without doing it myself... sorry for that!


For the MatchRect script, to be a bit more clear about how it works... Place it on the object you want to resize to match the text's bounds (so in your case, the background) and then in the inspector, you need to drag in the gameObject that has SuperTextMesh on it from the hierarchy into the "stm" field. (Ideally the objects are siblings in this case). 


But it sounds like Adventure creator may be trying to resize the box itself, so this might be the wrong approach... (Sorry it's been a very long time since I've had AC's code in front of me, so I need to guess... If AC is trying to set the box size itself, you need to remove the ContentSizeFitter from STM, and set the anchor presets on its recttransform to stretch. (So it'll match whatever AC is actually resizing) So in this instance, instead of the text controlling the box size, the text is fitting in the box size. Not entirely sure this is the case here though.



I'm actually not too sure what to make of that maybe useful info immediately... does it *only* happen when recording? Could the STM object have anything else on it causing an issue in this instance?


For the script I sent, forget about it for now because it was incomplete and I wanted to expand on it, I don't think it would have changed much in its current state. I also think the MatchRect script might be a more direct fix for this issue. But yes, it has public fields, one for an STM component, and one for a LayoutElement... it's meant to send values generated by STM straight to the LayoutElement, which could be a parent object in your case. It's C# code, by the way!


If I'm not able to solve it like this, I might ask you to sent over a scene for me to edit, I feel like it might just be one thing out of place, and the fastest way to know is by just pushing all the buttons, haha. I'd really like to isolate the issue because it's still not completely clear if it's an issue with STM, AC, or Unity Layouts!

Hey Kai - thanks man. Also been watching the YT videos you have linked on the Asset store page, and I wondered if I might try forego a lot of Canvas UI's stuff and try and get STM to do a lot of the work, since you seem to have 'Vertical Limit' build in to STM and I'd generally want to try and set the text at a predefined point above each character's head using AC's setting for each character, and then when the text goes over a certain horizontal limit, it expands vertically, preferably up. BUT, there's also an AC setting to always keep text inside the screen at all times, so one RectTransform object is requited I believe. Is there a way to automatically generate a kind of semi-transparent coloured background to the text, to simulate a text box? Then I maybe wouldn't need all the other nesting objects.

Yes, only seems to happen when recording with Unity's Recorder. At 60fps it's almost imperceptible but still noticeable.

Anyways, instead of me asking all these questions, I think what'd be best (like you suggest) is if I ZIP my project and send it to you to have a squizz at if that's ok. Will email you a GDrive link shortly.

If you can let STM do most of the work, see if that works for you! The AutoWrap feature sounds like what you're after, with VerticalLimit being its vertical counterpart. (On UI text, these values are controlled by the size of the recttransform, by the way!!! Unless"ui wrap" and "ui limit" are disabled.) 


The STMMatchRect code in my sample scenes really sounds like what you're looking for - it just takes an existing rectTransform which you can change the appearance of, and resizes it based on text size. (With options for which bounds it's copying.) So please check out the sample scene for that.


What is your monitor's refresh rate? If it's higher than 60, that means the issue shouldn't be something delta-related, so that helps narrow it down at least. (Thinking it's happening on a per-frame basis, rather than a per-time basis) 


Got your zip, will check it out shortly!