Been wondering I know in code c++ we name things using no spaces all in one word:
Ex: int hungerBar = 100;
But in blueprints naming is it alright to just name everything with underscores?
EX: Hunger_Bar = 100;
Hey there @WiseManDark! So âbest practicesâ is one of those things that is a bit different for everyone. It wonât break anything to use the underscores in BP variable names, but considering in blueprints you can use spaces for variable names many users do. I generally maintain the same convention without space or underscores personally, but having the spaces helps readability when working with lots of blueprint variables.
Are there downsides since itâs allowed? Cuz if itâs allowed and has no major downsides, I might just keep naming things with spaces for BP.
probably not in BP but i would say there is no advantage either. I think PascalCase is clear enough
Blueprint can really exacerbate naming issues because of how it inserts spaces or replaces â_â with them.
Hereâs two variables declared in C++:

And this is how they show up in the Blueprintâs variable list:
![]()
The show the exact name in the details panel though:


And now I can actually add a variable from blueprint with an actual space in the name!


And if I make a variable without a space from blueprint, the display name isnât changed the same way variables from C++ are!

![]()
The only real downside is that because spaces arenât allowed in C++ names, itâs easy/possible to duplicate a variable name from C++ by including a space and Blueprint will happily let you do that. If you always do PascalCase, Blueprint will be able to prevent you from creating a blueprint variable with the same name as C++ because they will be the same.
When will this be useful though, and is it worth it for me to redo most of my existing vars for bp to remove the spaces?
i wouldnt go back and change everything, it risks breaking too much in BP but start building better habits for your next project
Iâd agree with @Auran131, itâs not worth going back and changing anything that you already have. Just to change how youâre building things in the future. This is often why you see âbadâ code in projects. Something was learned that was âbetterâ but it wasnât retroactively applied to existing code because it wasnât worth the time or effort or consequences to change.