Lots of different meshes need to act as children of one blueprint

Hello. I have about 2500 different meshes set up in a scene made in maya that each need to be able to change color when the player collides with them, and also spawn other objects when they are clicked on.

Currently I have a working blueprint that functions correctly, but I can’t seem to figure out how to make it so that I can make all 2500 unique meshes also have that functionality without painstakingly duplicating the original 2500 times and manually setting the meshes.

I’ve tried using a seperate blueprint to loop and spawn copies of the color changing blueprint and set the meshes during run time, but as far as I can tell there is no way for me to (using blueprints, I’m trying to avoid C++) set the blueprint copies’ mesh to each of the 2500 options.

The functionality you mention in the first sentence can be achieved without changing them from meshes into blueprints.

So you could change the color and spawn objects from the player blueprint.

If I put all of the code in the player blueprint, how do I get the meshes of the objects that the player collides with? And also how do I check that those meshes aren’t ones that are not meant to change color? As far as I can tell the only identifying info a mesh has is it’s name. Unless you could use its filepath, but I don’t think that the BP system ever allows you to mess with filepaths

You use a line trace to find the mesh the player is attempting to interact with

You can also use ‘actor tags’ to mark the meshes you expect them to be able to interact with.

Agree with ClockworkOcean, just leave the meshes as meshes.

You could use tags, but if this is a big part of your game if might be worth making a collision preset or channel for this, depending on the details of how you want it to work. Another way would be physical materials. Anything you want to react to the player, set it to a special physical material. Then, on collision etc see what material was hit.

Also, try not to set the object tags (or collision settings or phys materials) at runtime. Just make an editor utility script that sets it up (tag, or collision, or phys material) in the editor. One way is to write a script that iterates over all selected objects + components, checks the name, and if it matches set the tag (or collision). Then, select all objects in the scene and run your script.

(You could automate it so the script runs automagically, but I’d prefer to make it a manual context menu script if it was me.)

And that way it’s already set up when the level loads.