Dynamic spawning actor blueprint

Hey guys,
I’m trying to create something that seems to be too difficult for me and so I’m looking for your precious help :slight_smile:
I’ll try to be clear on the description of what I want but it is not easy to explain.
So, what I try to do is to create a blueprint actor that will spawn a user selected amount of cubes side by side and with a selectable length of each cube. The way I would like to select the amount of cubes is by using something like a + sign in the blueprint details panel and, every time that + sign is clicked it spawn a cube and a new variable in the details panel for selecting its size. These Photoshop’d image may be more easy to understand what I’m trying to achieve…

Is that possible using only blueprints?

Thanks a lot in advance for your help !

Easy to do mate. Make a new custom event in your BP and ( with it selected ) tick the ‘call in editor’ box in the details panel.

This way, you can get your plus sign for new cubes and the size buttons you’re talking about… ( or very similar functionality ).

Nice, that seems to be easy indeed :slight_smile:
I’ll not have a chance to test that before Monday though but I’m pretty sure you saved my day :slight_smile:
Thank you so much

i think it may be a bit more complex than your thinking.

to have a setup like what the OP has in the picture you would need to use something like a map (mesh(mesh), size(float)). I don’t believe maps use indexes do they so you would lose track of the order. If you wanted to use an array then you would have to decide on one variable type. that leads me to thinking a struct for each array index, that way you can store the mesh and the size in one index. from there you would just need to have a script to update the locations of the cubes whenever the size value is changed.

i noticed one other potential issue whilst testing, when i tried to do this using add static mesh component the components would be destroyed if the actor was moved or if a variable changed (changed size variable). now this may be due to something i’m overlooking or maybe the engine version i’m using (4.17) but i figured i’d note it.

Good point… Besides that I just realized I can’t use Custom Event from the Construction Script which is annoying because using that method I’ll have to in play mode to see the result. I would have preferred to see the final result in Editor mode, so using Construction Script.

you can actually run custom events from the construction script. just create them in the event graph then call them from the construction script. also though you can create custom events and run them directly in the level editor like clockwork mentioned. to do this create a custom event, then with the event selected go to the details panel and check the box for call in editor, then place the actor in the level, with the actor selected you will find a button to run your event in the details panel.

Or, you could just get this:

I think it might be easier if all the cubes are inside on BP?..

( I could be ‘under-thinking’ it… )

Thanks for the suggestion. I already own this asset but there are too many things in there I do not need and I want to keep my project as clean as I can so create my own stuff is better and will also increase my knowledge :slight_smile: Full benefit :wink:

I’m doing some good progress thanks to your help. Thank you very much for that again.
Quick other question, the calling button for the Custom Event appears in my Actor’s “Default” category. Is there a way to change the category as we can do for variables? Pure cosmetic :slight_smile:

im not really sure as ive never tried to add one to a category before. I took a quick look to see if its possible but didn’t see any way to do it.