I’m trying to create a world editor of sorts. I have a combobox that I want to populate with a list of all actors of a specific type included in the game (not just loaded into the world) based on type. For instance, I’ve created a C++ class “Civilian Buildings” that inherit from Actor. All of the blueprints that fall into this category have been assigned this parent class.
What I want to do is be able to tell my code to select every actor that falls into this category, and populate my combo box. That way, I could load up a blank world, and select from small house, big house, hotel, grocery store, etc. as needed.
That sound like a very poor method of doing this. I would instead create a render of each asset and put it in a widget and, when clicked, select it and let another click spawn the asset for real. If you want to preview it you can do so by making the model follow your mouse pointer until you click.
If you want a special look, like for example hologram-esque, you can give it two materials. One for when selected and another when placed.
If you want to limit the types of assets you see more dynamically you can use a macro called TSubclassOf. To get this list into the visuals in your widget I am not sure. You will have to look around or wait for another answer.
Could you explain why this would be a poor method?
If you’re meaning poor idea to use the combo box, I agree. This would just be temporary implementation while I focus on generating my list. I would then change to rendered images.
However, I do want to create the array of unspawned assets dynamically, not hard coding the ability to spawn each asset (like it appears you’re suggesting) so that later on, all I have to do is add the assets with the appropriate subclass without then having to create implementation widgets and so on for each one. If that makes sense?