I’m doing a Unreal 4 C++ course and the teacher always does blueprinting before adding a C++ class to the level and I don’t know why he does it.
Searching on the Internet I have found a book that says:
“Blueprinting is just the process of deriving a blueprint class for your C++ object. Creating blueprint-derived classes from your UE4 objects allows you to edit the custom UPROPERTY visually inside the editor. This avoids hardcoding any resources into your C++ code. In addition, your C++ class to be placeable within the level, it must be blueprinted first…”
But I can place a C++ class into the level without doing blueprinting.
Why we do blueprinting? What can we do doing blueprinting?
Hello! You can think of it like C++ hierarchy is some base and checked stuff, while BPs are “leaves of tree”. You can quickly change BPs configuration and test it in game. I think that BP is very comfortable thing to test and prototype. And when you are ready to finalize things - just move them into C++.
Thanks but I’m not asking that, or maybe I haven’t understood your comment. I’m asking why do I need to blueprinting my C++ to add it to a level. Thanks.
You don’t always need to create a blueprint derived from your C++ class. This is mostly done for fast iteration where you create variables in your c++ class and expose them to blueprints and then tweak the variable values from blueprints rather than compiling the c++ code again which is significantly slower compared to blueprints compilation (this isn’t limited to variables but any logic that needs rapid iteration or for tasks that are more simpler to do in blueprints than c++ like input bindings).
For c++ classes that don’t expose anything to blueprint or doesn’t need tweaks or changes frequently, you can skip creating blueprints derived from those classes.
“In addition, your C++ class to be placeable within the level, it must be blueprinted first…”
Thats not true, any Actor class regardless how it was created C++ or Blueprint (or anything else as technically this is also possible you may encounter something like this in 3rd party tech, UE4 actually allows you to do that) can be placed on level or it explicitly been flagged to be NotPlacable (in C++ you do that in UCLASS). There 2 ways to place C++
Using class viewer in Window->Development Tools->Class Viewer, you will have list of all classes (including blueprints!), you can drag and drop class on the level. Btw, this is original way of placing actors in the level before UE4, in UE4 they put more focus in content browser, this might be due to fact that UnrealScript files was not assets while Blueprint in UE4 is asset.
Content Browser since log time ago also list C++ classes and oyu can drag and drop them too click << arrow in content browser and you will see C++ directory, those are virtual assets. They made this for blueprint only users as they used to new workflow of drag and drop blueprints in UE4.
I personally recommend have Class Viewer open in tab if you do any C++, you can clearly see what classes are loaded and there relations. The way blueprint been set up makes people confused since very beginning of UE4, but Blueprints are same as C++ classes they simply written in different languages.
I hVe recently found that spawning blueprints is much more costly than pure c++ classes. There should be a memory/cache overhead aswell. Would be cool to know if you keep working with pure c++ and how it went.