It seems like Unreal automatically adds spaces to the names of functions and events defined in C++ (e.g., void MySuperAwesomeFunction()
becomes My Super Awesome Function
when called in a graph). But, when defining your own custom events, macros, or functions in Blueprint, you can use spaces in the name and it does not appear that the engine automatically adds spaces to a camel-cased name (e.g. MySuperAwesomeMacro
appears as MySuperAwesomeMacro
in the graph).
Is it all right to use spaces? Should they be avoided? I could swear I read in a guide somewhere to avoid spaces but I can't seem to find anything on it right now.
There are a few things to consider here.
You can imagine blueprints as something the engine turns into C++ when you are done. But since you are never going (nor will be able to) read that code, the engine can name the functions anything it wants. So it doesn't really care what you call them as it has a map internally mapping Check if this ball can bounce?
to FUNC_ABZ
or something like that.
This is why you can do many strange things like starting functions with numbers, adding special characters, having spaces and more.
If you consider this then it is actually a lot of power. Like anything else with programming languages with great power comes great responsibility. The fact that you can do this is a pretty great step towards being able to give meaningful names to stuff - BUT - it comes with a cost. Your own standardization and consistency is extremely important.
In my opinion and how I develop (similar to concepts when you write code) I try to give functions names with actions and verbs and variables are more nouns or explanations of what they hold. I use this feature of blueprints to the fullest. (so a C++ isStarted
boolean would definitely be has the great event started ?
in blueprints)