x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:

alt text

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

Product Version: Not Selected
Tags:
more ▼

asked May 13 '14 at 01:31 PM in Rendering

avatar image

Skye Mohlin
16 4 7 9

avatar image Lovecraft_K ♦♦ STAFF May 13 '14 at 02:41 PM

Hey SkyInAPond -

Could you upload a screenshot of you HUD blueprints so we can try to reproduce and diagnose the issue for you?

Also take a glance at the Content Examples Blueprint_HUD level as this HUD uses a slightly different way of rendering out the HUD based on screen space which might work better for your goal.

Thanks

-Eric Ketchum

avatar image Skye Mohlin May 13 '14 at 10:26 PM

It is literally just a Pawn-blueprint, in which I've added a few TextRenderComponents (along with other objects, since the HUD is actually attached to the Pawn). I never set the size in the graph, only the text:

alt text

alt text

components.jpg (133.0 kB)
text.jpg (254.7 kB)
avatar image Lovecraft_K ♦♦ STAFF May 14 '14 at 01:55 PM

Hey SkyInAPond -

I have been working on trying to reproduce your issue and have been unsuccessful as of yet. I do want to check does any element within the Pawn class have a function which scales them? If you are willing, I would be happy to look at the actual uasset, but either way I will keep working on it.

-Eric Ketchum

avatar image Skye Mohlin May 14 '14 at 05:01 PM

Can I send it to you personally, I'd rather not have others accessing it? :P

BTW, changing the original to about 5% of the original worked and got them back close to the correct size.

avatar image MulleDK19 Nov 12 '14 at 02:18 PM

This is really annoying. TextRenderComponent is useless after packaging. The text is 40 billion times larger in packaged games, and the characters are all wrong.

avatar image Lovecraft_K ♦♦ STAFF Nov 18 '14 at 10:56 PM

Hey MulleDK19 -

Have you looked into your asset creation chain as mentioned below? As a test you should be able to package Content Examples which has many text render components in and out of blueprints which should package correctly.

Thank You

Eric Ketchum

avatar image MulleDK19 Nov 19 '14 at 11:07 AM

Now sure what you mean by creation chain.

But this has been a problem since the first UE4 release. It's all TextRenderComponents in any project of any asset. But only after packaging.

avatar image Lovecraft_K ♦♦ STAFF Nov 19 '14 at 03:15 PM

Hey MulleDK19 -

By Creation Chain, I mean the process that you have in getting the text render component into your world, be it either through a blueprint of just placing the component directly into the level.

Just to confirm exact what you are saying, if you package Content Examples all Text Render Components increase in scale, or only projects you have created with text render components increase in scale?

Thank You

Eric Ketchum

avatar image MulleDK19 Nov 19 '14 at 08:52 PM

It seems to work with the Content Examples. And trying to reproduce it on new projects has yielded no results.

I just know that every time I've tried to use the TextRenderComponent in any of my projects, they become oversized in the packaged game, and I have to make them tiny in the editor, to have them a reasonable size in the packaged game. It's not based on scaling on any parents, or any calls that scales them. And I'd assume that would show in the editor if that was the case.

Recently I added a text render component to two different actors; my character, and a simple actor with just a mesh, and both were enormous in the packaged game. Furthermore, all the characters appeared as just squares, like ☐☐☐☐☐☐☐☐

avatar image Lovecraft_K ♦♦ STAFF Nov 19 '14 at 09:19 PM

Hey MulleDK19 -

This has to do with font setup when you first import it into the engine, since the engine treats fonts as a texture, some fonts will include pages and those pages will vary based on imported font size, larger font usually equals more pages. However, all of this should be visible in the Editor before packaging. And you are not doing anything more than spawning the text render component? I am happy to continue to look into this if you can send me a project in which this occurs and if you are using a custom (not engine specific) font I will need that as well. You can upload a zip here if small enough or upload to dropbox and post a link.

Thank You

Eric Ketchum

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

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!

more ▼

answered May 13 '15 at 05:32 PM

avatar image

vanzeipel
31 1 2 3

avatar image tomvernon Feb 10 '17 at 09:52 AM

In case anyone else is running into this issue, I was able to fix this by making a minor change to the engine source in TextRenderComponent.cpp, thanks to the hints in vanzeipel's post. As stated above it seems that InvDefaultSize isn't correctly initialised in some situations (one of those being a text render component with a custom font in a standalone windows build). To fix, I added this small snippet to the bottom of UTextRenderComponent::PostLoad() :

         if (Font)
         {
             float LocalWorldSize = Font->GetMaxCharHeight();
             InvDefaultSize = 1.0f / LocalWorldSize;
         }

Hope that's of use to someone!

avatar image Chris Payne Jan 29 '18 at 10:37 AM

Further to Tom's fix...I've come across a case where even this doesn't work because the PostLoad for the TextRenderComponent is called BEFORE the PostLoad for the Font (which initialises GetMaxCharHeight()).

IMHO the most robust solution is for GetMaxCharHeight to self-test and call CacheCharacterCountAndMaxCharHeight() if it's uninitialised - but that still requires Tom's fix to correctly set up the TextRenderComponents.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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?

Eric Ketchum

more ▼

answered May 14 '14 at 05:11 PM

avatar image

Lovecraft_K ♦♦ STAFF
36.6k 703 260 737

avatar image Skye Mohlin May 15 '14 at 08:01 AM

Indeed I am adjusting it via the World Size variable! Is this the wrong approach?

avatar image Lovecraft_K ♦♦ STAFF May 15 '14 at 06:38 PM

Hi SkyInAPond -

Not necessarily, but the scaling issue you are having is somewhere in the asset creation chain whether in import or a blueprint, you will have to track down any part in the chain where the text is changed and ensure that it is not also associated with a change in scale setting or font size change.

-Eric Ketchum

avatar image Skye Mohlin May 15 '14 at 06:44 PM

Ok, thank you very much! ;)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question