I am currently trying to make a script in construct where you can randomly place out a forest within a specific grid (think different types of trees, rocks etc…). It’s working without issues when I have a single instance static mesh but when I try to use multiple it simply selects the first one and makes all other instances the same one.
I just added 3 instanced sm components, and used a select node to randomly pick one to add an instance to during the loop (or just the first if multiple meshes is false). Add more ISM components as needed, then add pins to the select node and plug them in. Mine is done in a function called by the construction script, but it could be done in the CS itself.
I REALLY like how this is looking, seems to answer my question, I only have one nitpick, is it possible to make it so that you can add / remove static instances in the viewport? Since its a bit counterintuitive to make a tool where you have to constantly go in to the blueprints to add/remove more static meshes.
Sure. If you add meshes in the level viewport, or just don’t want to muck about with the select pins, you could use getcomponentsbyclass and plug that into the addinstances node.
if you are looking to remove a specific instance, theres a function to check overlap (use a box). it returns an index, which you can then use to remove the instance from the instanced static mesh component.
from what i remember its a bit busted but i got it working eventually. its using local space when it shouldn’t or something idk.
Although I did notice a problem after doing this, It would seem like the instance is run every time anything changes, So once I change the grid size or the seed it creates a new instance on each and every new location without removing the old ones