How can my C++ Actor Component contain a list of blueprint classes that can be modified in the editor?
I have a C++ component that generates a map. I want this component to be able to place random vegetation.
Each possible type of vegetation is a blueprint actor, and I want my component to be able to spawn any of them.
For that, I want to have an array in the C++ component that contains reference to the blueprint classes, so they can later be spawned. This array should be editable in the editor.
I found this thread which asks a similar question, and one response gives the following solution:
The problem with this solution is that you still need the path to the blueprint hardcoded in your code. What I want is something that can be modified in the editor, without having to edit the code.
I have found another answer in this question with the following solution:
This looks like what I would be looking for, except it doesn't work. I tried adding a UClass* field this way to my component, and it doesn't appear in the editor at all.
Here is my code:
And here is the result in the editor:
As you can see, the "VegetationActor" property doesn't appear at all.
Is there any way I can have an editable list of blueprints to spawn like that, or is the only option to hardcode all of them?
ok 1. Blueprints take too much CPU for you to run around sprinkling them down like grass seeds.
Should look something like this:
But you can make it easy for yourself if you create an empty class that you derive your BP's you want to find. Then you can change the
answered Mar 01 '18 at 05:44 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here