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 do certain FNames get capitalized in packaged builds?

I have the following code:

   FName happy = FName(TEXT("happy"));
   UE_LOG(LogTemp, Log, TEXT("%s"), *happy.ToString())
   FName h = FName(TEXT("h"));
   UE_LOG(LogTemp, Log, TEXT("%s"), *h.ToString())
   FName index = FName(TEXT("index"));
   UE_LOG(LogTemp, Log, TEXT("%s"), *index.ToString())
   FName i = FName(TEXT("i"));
   UE_LOG(LogTemp, Log, TEXT("%s"), *i.ToString())
   FName joy = FName(TEXT("joy"));
   UE_LOG(LogTemp, Log, TEXT("%s"), *joy.ToString())
   FName j = FName(TEXT("j"));
   UE_LOG(LogTemp, Log, TEXT("%s"), *j.ToString())

In the editor I see expected output:

 LogTemp: happy
 LogTemp: h
 LogTemp: index
 LogTemp: i
 LogTemp: joy
 LogTemp: j

But in packaged builds I find certain names unexpectedly capitalized:

 [2018.02.23-21.08.07:946][  0]LogTemp: happy
 [2018.02.23-21.08.07:946][  0]LogTemp: H
 [2018.02.23-21.08.07:946][  0]LogTemp: Index
 [2018.02.23-21.08.07:946][  0]LogTemp: I
 [2018.02.23-21.08.07:946][  0]LogTemp: joy
 [2018.02.23-21.08.07:946][  0]LogTemp: J

This is causing me trouble in other projects where I convert FNames to char* for comparison purposes. I know that FNames are case insensitive, so is there something unsafe about using them in this manor?

You can find the project that generates this output here .

Update 5/1/2018: Removed project hosting.

Product Version: UE 4.17
more ▼

asked Feb 23 '18 at 09:44 PM in Packaging & Deployment

avatar image

8 1 5

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

1 answer: sort voted first

The case of an FName depends on the first instance that is created with that unique (case-insensitive) string. If you create the FName for "x" and other packages (or code) uses the FName "X", whether the x is uppercase or lowercase will depend upon which of those is encountered first by the engine. You can not change this behavior so make sure that all uses of the string treat the FName as case-insensitive.

more ▼

answered Feb 24 '18 at 02:04 PM

avatar image

136 1 3 4

avatar image keenan.reimer Feb 26 '18 at 10:54 PM

Thanks for your response. That makes sense. It's interesting that this behavior changes between the editor and packaged builds. Are there modules that get loaded in packaged builds that aren't present when running in the editor?

avatar image GBX_botman Feb 26 '18 at 11:00 PM

Yes. Running a commandlet to cook or package the game takes a different code path than running the editor or game. If you want to know what code is causing an FName to get added with a specific case, you can set a breakpoint in the FName::FName constructors in UnrealNames.cpp and do a strcmp() looking for a specific case being used.

(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