Is there a way to reset FNames (wrong capitalization, etc.)?

One thing that was super annoying in UE3 was a side effect of the fact that all strings used in the editor were stored as FNames, which are case insensitive and that there was no way (at least that I know of) to reset them.

So if you typed MyVAriable instead of MyVariable once and saved, that capitalization would be in your project forever. This was even more annoying when two capitalizations can have a valid meaning (I’m looking at you, Block and bLock).

FNames are still used in UE4, and their behaviour seems to be exactly the same. Is there a way to reset one specific FName if you happened to save your project before noticing your typo ? Any kind of tool, even a simple command line, to do that would be great.

This kind of things just drive me crazy (and I’m sure I’m not the only one) and I usually end up renaming the offending variable to something slightly different to preserve my sanity but this is a far from ideal solution…

Thanks in advance.

#Press F2

Highlight your variable

Press F2

and you can rename it to fix capitalization

Does that work?

I’ve seen cases where it doesn’t but by majority I can fix any typo using F2

I am not trying to sound silly here, just reflecting on my own experience, and therefore clarifying the matter for others if your case is something else

Rama

Well, pressing F2 only works until the FName is registered, which happens when you save your asset I think.
That’s why it works most times : because the FName is not saved in the FName table yet.

But once you’ve saved your asset, the FName is registered and the incorrect capitalization is saved, apparently forever. Hence my question : is there a way to alter/remove a registered FName ?

I know that the doc says that “They are immutable, and cannot be manipulated” but there are a few instances in the code where FNames are modified to resolve case conflicts (cf FNAME_Replace_Not_Safe_For_Threading), having a command line that allows the recapitalization of an FName (at your own risk, obviously) would be pretty nice…

We’ve made a change for 4.5 which will make FName case-preserving for the editor and UHT. This should address the FName case issues you’ve been seeing.

I’ve checked that you’re able to rename asset, actor, and blueprint components in a way that changes only their case. I’ve also tested that you’re able to have a variables in different UObject/UStruct types that vary only by case, and that the UHT will generate code that actually compiles.