I am trying to spawn in blueprint class (a model imported from outside the unreal engine) in c++.
This model is stored as a blueprint class which i can drop into the world inside the editor.
It might just be a simple/stupid question, but since it was made inside the editor, i don’t know how i would use this inside the c++ class i which i want to spawn the models from.
However, i now need to spawn X amount of them in a somewhat random location which just seems easiest by using a c++ class, but if it is easier doing this using a blueprint, I’m open for suggestions.
So my question is, what is the best way going about spawning my model blueprint class, or how do i get hold of this blueprint class in my c++ class?
Here is a way that lets you set the class in editor with nice filters, and prevents any paths from beeing involved in C++ (which is always a bit dirty):
Derive the Blueprint-Class that you want to spawn on a c++ class (might just be empty, doesn’t matter).
Since it is UPROPERTY(EditAnywhere), you can now find an instance of the object, that will spawn your class and edit the “ClassToSpawn” Property. There will be a drop-down-menu, where you can select the class that you want to spawn. Only Classes (Blueprint and C++) that derive from “YourCppBaseClass” will be shown.
I would not recommend this, since having direct paths in cpp is always a bit dirty. Also you would have to recompile every time you change the class. I added an answer, that is cleaner and easier to use.
Sorry for the late reply, but how would i derive the class to C++ file? would that just be making an empty c++ file and then linking it too this blueprint class?