RTS setup a static mesh switch with a button

seems to me people are way over complicating this. if you have a bunch of blueprint classes and you want to cycle through them then all you really need is to have an array which contains the classes, and a function which spawns and despawns the class based on a index. the trick to it is that you set the variable type to be that of the parent class. This is based on the additional information you provided [here][1].

below is an example of how this could be done. the basics of how this example works is when a button is presses in a widget we spawn in a building from one of the arrays, then when we want to switch the building thats shown we destroy the current building and spawn in a new one from the array either the index prior or after.

when the button in the widget is pressed it calls the buildingTemp event which spawns the initial building from the array and sets the current building (picture1). also in picture one you will see a method for placing the current building wherever the cursor is. in picture two you will see how we scroll through the buildings by increasing or decreasing the index int, we also need to ensure that the index is in range at this point too by comparing the current index to either the last index or to 0. once we’ve modified the index and ensured its inrange we destroy the current building actor, spawn the new one, and set the current building var. the last bit of script is placing the building which consists of just un-setting the current building var since the building will already be in the place it should. the last picture shows another method to simplify doing the variants since im assuming its just different meshes for different field types ice world, wood, etc.

I’ll have to try this after work tonight thanks for the help appreciate it, quick question though. If I already have a way to spawn/destroy actors is all this above needed or will they possibly conflict in any ways? I guess you wouldn’t be able to see for sure without seeing my code first but.