Why does myTextRenderComponent fill the screen on my packaged game?
Hi, we were doing a test-package today, and realised that the TextRenderComponents we have on our 3d-HUD literally fills the screen:
It seems to be something to do with it's original scale, as when we scale the blueproint that owns these components, they scale with it as well (get even bigger). Is this a bug or something we're doing wrong (it works fine in all preview-modes)?
//Thanks in Advance
I've been having the same issue for a while now for my offline fonts (runtime fonts in UMG are fine). I've done some digging using the latest engine version, 4.7.6, and I think I have an answer.
The root of the problem seems to be that an offline font asset isn't loaded into memory when an actor's TextRenderComponent is being setup. For me, this happens only on Windows cooked/packaged builds (iOS doesn't have this issue). Playing in the editor or playing a stand-alone instance through the editor avoids the issue. I suspect the offline font asset is already in memory at this point.
The TextRenderComponent has a property, InvDefaultSize, that is used in the render matrix calculations for the characters to display. Normally, this should be a small number (at WorldSize 26 this is 1.0/26.0, or 0.03846). However, in my cooked Windows builds, I was seeing this value as 1.0 when my breakpoint in AActor::BeingPlay was hit on the offending actor. Digging into the engine source, UTextRenderComponent will set InvDefaultSize to 1.0f in two scenarios:
1) If the font's GetMaxCharHeight() returns 1 (meaning the characters are 1 pixel tall in the texture sheet).
2) If UTextRenderComponent::SetFont is called without a valid UFont pointer (TextRenderComponent.cpp, line 870). This is the most likely cause.
Only actors I placed in the level seem to have this issue. As a work-around, any actors that have a TextRenderComponent with a custom font should be spawned after the player has entered the level (I do this in my GameMode's BeginPlay function). There's a better solution out there (or one that may require a fix in the engine code), but this will at least get you around the problem in the meantime.
Hope this helps someone out there!
answered May 13 '15 at 05:32 PM
I understand. If you are able to fix it by just reducing the correct size it sounds like there could be a scale that is being applied somewhere in the assets chain. I noticed in you component screenshot you have multiple world size values for your text render objects, but the same X and Y scale. Is the world size how you are adjusting the scale or are you doing it through the Transform scaling?
answered May 14 '14 at 05:11 PM
Lovecraft_K ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here