Download

Querying UMG textblock height?

We are working on a dialog system in our game and have decided on UMG. It seems to be pretty powerful for the most part. I have multiple sentences I would like to write out via chat bubble. I’m stuck on determining when to pause for the user in order to allow them to tap to continue. I want to be able to tell when a textblock is filled (wrapped) up until a certain point so it doesn’t scroll but instead pauses for a tap. This can be done if I can tell when the total height on text in a textblock exceeds a certain threshold. The only problem is there doesn’t seem to be a way to query for such a value. Is there any way to do this that I am unaware of? Any help would be greatly appreciated!

Thank you for your time community,
-jv

There’s not - that information is not accessible outside of when the textblock is painting. My recommendation would be to create your own native control in slate that can handle that special case logic and then make a simple wrapper for it in UMG. You could use the STextBlock as a starting point for the implementation.

Thank you Nick. I will have to look into what you are referring to. Are there any other pointers you can give me in order to create such an object in slate? Demo’s, tutorials, etc?

Thanks,
-jv

WOW. the GetDesiredSize BP node off of the TextBlock is adjusting as I add characters. I can just key off of the height given a threshold and adjust accordingly!!!

Assuming you are fine only calculating it after each tick that’s a way to do it, but that function on accesses the previously calculated desired size.

Once the viewport has been shown twice I can call a method (c++) to set the text, process the layout and pull the desired size for each character added. I can break up my lines easily enough at that point without doing it on each tick.