Download

Changing Static Mesh Class Of A Static Mesh

Hi, I am working on an open-world game, the game has a lot of buildings/towns and I have made a blueprint that allows me to load and unload whatever is inside the building when the player is at a certain distance, right now I have to handpick each static mesh within the building and add them into an array inside the blueprint.

What I am trying to do now is have the static meshes inside the buildings and towns put into different classes without making everything into a blueprint and having to replace all the already placed static meshes so that I can then have a Furniture class of static meshes, and a Building static mesh class of sorts for the modular buildings.

That will then allow me to do a, Get All Actors Of Class, with an, For Each Loop, to quickly get all the furniture into the array on Event Begin without also getting the outside and parts of the buildings into the array (which would happen when I do a Get All Actors Of Class with Static Meshes).

I’ve been unsuccessful at figuring out how to do this and if it is even possible, I know you can change the parent class of a blueprint quite easily, and I’m hoping something along those lines could be done to sperate my static meshes.

Thank you in advance

Tim

Hi man,
if i get it right you would like to,
Create a blueprint Palace, that automatically, fill an array with all the blueprint furniture you place inside, so that you can load and unload them.
Create a blueprint city, that automatically, fill an array of palaces-blueprint,?

Well for the first part you could get all the overlapping actors with a component of the palace,
and save the array or item found on a saveslot o wherever you need.
Beware that you have to save 1 array for the kind and 1 array for the transform or every item

The city is quite the same, or , as you said youself
could just get all actor of class “palace” and again, save 1 array for the type of staticmesh shown, and 1 for the tranform.

Thank you very much for your response, I might have been a little unclear with explaining, my problem is that all the furniture assets are already placed inside the level and they are all static meshes, not blueprints, so whenever I do a get all overlapping actors of class (Static mesh) I get parts of the building around it as well because the building is also made up from static meshes and its quite hard to make the box have the exact shape of the building since all buildings are different, thus I keep getting walls inside the array that also overlap the box, that’s why I was hoping that there might be a way in which I could change the class of a static mesh, without making it into a blueprint and assigning a parent class blueprint. Or a way in which I could separate static meshes from each other. I appreciate your help :slight_smile:

Sure man,

first, just for clarity, when you drag a static mesh inside the level, it became an StaticmeshActor .

Every actor in the level can have a tag,
Just select a staticmeshactor in your level and go in the detail on the right,
in the search type “Tag”
In the Actor Tag you can set a tag like “Furniture” or “Walls”

When you make the array, you can check if the actor in the overlap have a tag Actor Has Tag | Unreal Engine Documentation
and thus ignore him in the making of the array

So if you have 15 walls and 50 furniture object, you could set the tag for the walls, and ignore them while making the array,

Thank you! the tags did the trick, you just saved me a lot of work. Appreciate it!