[BUG] Blueprint editor does not allow renaming a variable if there is only case change

Not sure if this has been reported before.
I encountered a ‘bug’ with blueprint editor today.

Sometimes the blueprint editor does not allow me to rename a variable with a case difference. Ie if the original variable name was ‘Activemode’ and I try to rename it to ‘ActiveMode’, it will reset back to ‘Activemode’. The only way to change it is to rename it to something else entirely and restart the editor (the entire UE4 editor ), and then rename it.

Steps to reproduce:

  1. Create a new blueprint extended from Pawn
  2. Create a new boolean variable named ‘bNavigationModeactive’
  3. Edit the variable name and change it to ‘bNavigationModeActive’
  4. See that the name immediately resets back to ‘bNavigationModeactive’

Even if you change ti to some random name like ‘asdasdasda’ and then rename it to ‘bNavigationModeActive’, it will still reset. At the moment to change it correctly, you must do the following

  1. Rename it to a random name such as ‘asdasdasda’
  2. Quit the full editor
  3. Restart the editor and rename the variable to the proper value.

It looks like the blueprint editor is remembering previously used variable names (but not their case). You have a similar issue in Windows file explorer. IF you rename a file and only change the case, it will reset back.

Much like in Unrealscript, variable names are not case sensitive. I believe the Blueprint bytecode is actually derived from the Unrealscript bytecode, so this may well explain why.

But yeah, you should be able to rename a variable!

Right!
But the problem is Blueprint editor expects variable names to be in Camel case. It uses that to display a user friendly name for the variable.
For example,
bIsActive will display as ‘Is Active’ in nodes
But
bIsactive will only display as ‘Isactive’ in nodes, which does not look right.

Any plan on fixing it?? At the moment it is very annoying. Lets face it, people are very likely to mispel (case wise) their variable names and would want to change it later.

Is there any work-around?

Thanks for the confirmation.

why not add a button next to the FName text box that uses FNAME_Replace rather than FNAME_Add? or you could give access to a human readable name list that can be searched and edited.

It’s an unfortunate side effect due to the way FNames work, as explained here: Renaming Blueprint with same name but different case does not work - Blueprint - Epic Developer Community Forums

Unfortunately once an entry has entered the FName string table, it’s surprisingly difficult to purge it again, and there’s no real way to work around it either.

I am (as a side-project) looking into how difficult it would be to make FNames case-preserving, but I don’t want to make any promises that it will actually happen, because any changes to a fundamental type like FName will have to be thoroughly vetted and tested.

We are aware that it is an annoying issue though, so even if this doesn’t pan out, we’ll likely look into other ways to address the issue.

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.