Converting FString To FName not exactly in the building game

There is a bug for Converting FString To FName happaned in following code just in building game.

FString aStr(TEXT("Fire"));

FName aName(aStr);

In my case . I am working on a key binding work.

I want to convert a FString to FName then set it as FInputActionKeyMapping’s ActionName.

but when I convet FString “Fire” to FName storage the “Fire” To “FIre”(the second letter was convert to Upper)

I think it is because this bug cause “UInputSettings” have many this kind of wrong bindings in the building game but The editor mode it is correct.

Hi ,

What version of the Engine are you using for this? In 4.6.1, there is no FName constructor that accepts a FString parameter. Is your actual code for accomplishing this different?

I am using 4.6.0 version

I am sorry for the delay in getting back to you. I tested this issue again in 4.6.0, but was not able to see the results that you described. I added the following code to the constructor for a character:

FString aStr(TEXT("Fire"));

FName aName = *aStr;

GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Black, aStr);

When I played the game in PIE, the text that was output was “Fire”. Where are you looking at the FName value when you see it displayed as “FIre”?

it is not in PIE it just appeared in packaged window game

I tried packaging the game and received the following results:


The blue line is from the line of code that prints the value of aName, and the white is a UMG Text Block Widget showing the value of aName. This image was taken when I packaged for Windows 64-bit. I received the same results when I packaged for Windows 32-bit.

ok,I will find the problem. thank you very much.

If you have a small sample project where you are seeing this behavior, could you upload that?

Ok, I will try to make one

Hi ,

We have not heard back from you for a few days. I will be marking this post as resolved for internal tracking purposes. If you get a to create a sample project, please feel free to upload that and re-open this post.