Download

Reference all Static Mesh Actors in folder or with a specific name

So I recently exported all the assets of some game, and there are crates that you move through and collect them. Just like coins in games like Super Mario. (only now in 3d)
But every crate is a different StaticMeshActor.
They all have the same name only with a different number: CRATE_WOOD_001 CRATE_WOOD_002, you get the point.
Now I want to check on collision on one of the crates and then delete it, how would I do that without making like 250 different checks or deleting all of them at once?

Would it be possible to check for the “CRATE_WOOD” part or check for the whole folder?
I hope I could make my question at least a little bit clear.

Blueprints would be preferred.

Thanks in advance!

u dont need to create 250 actors for each one. just create 1 actor called pickups for example and then on component begin overlap use the DestroyActor node. u can change the mesh by clicking on each instance in the world.

Hey, thanks for your reply!

The thing is: normally, I would do it the same way too, only now because I extracted everything from a game, every pickup is a different object, so how would I go about it that way?

Changing the all the meshes to one specific crate didn’t work either, then they all move to the location of the source crate.

So I’m assuming you mean every crate is its own actor and its own asset. That’s obviously not optimal, but in that case, you would put the OnHit/OnOverlap logic in the character instead, and whenever the character hits something, if the object has the name “CRATE_WOOD” in it, destroy it.

You could also just replace all the crates with the same actor using a construction script.

Hi, thanks for your reply!

That is indeed the case.

Would you be able to point me into the direction of how to do what you said? The checking for the name, I’m kind of new to this.


I tried this but this didn’t work at all, of course, when connected to the delete-object stuff

image
The hit event is for the capsule component so that only the it can trigger the hit, not the whole character (like the mesh).

There are other ways to do this (for example, get the name of the static mesh used in the actor), but this is the most straight forward.

1 Like

Hey, thank you so much for even recreating it! This works absolutely perfectly!

1 Like