How do I get specific Foliage Types out of an overlap?

I’ve just switched my game from a hand painted foliage system to a fully procedurally placed foliage system (using the procedural foliage volume). However one specific system, even though it works as intended, does more than it is supposed to do now.

The player is allowed to place buildings in the world and when a building passes all collision tests with other buildings, tress, rocks etc. it will be placed down and all the grass in a specific area (a collision sphere around the building) is being deleted. This still works, but since tress, rocks etc. are part of the same foliage system now (they weren’t before) they will be deleted to.

So I somehow need to collect all the foliage that is colliding with my collision sphere and then get e.g. the foliage type to decide wether or not to delete the object or not. I’ve attached an image of the current system that just gets all the foliage elements and delets them no matter what. Does anybody have an idea how to easily expand this system to check for specific foliage types? So basically just collect the grass types, flowers etc. but not the trees, rocks etc.

edit: you can ignore the return node, itshould be connected with the completed port of the foreach loop.

One update. So I was able to almost do what I wanna do here. Since I can get the instanced meshes I can get their materials. So by comparing the materials I can find out which object is just a type of grass or a tree, rock etc. and only delete the ones I want. However I have to update the list of possible materials whenever I wanna add something new to my Foliage Spawner.

If I could find out which material type something uses this would be much easier, since I could make all the grass be a child of the same material type or something like that.

can you use naming conventions to pass through an “if” statement to toggle eligibility?
e.g. Make sure all your grass meshes have “grass” in the name then use that string as a filter?

Yes you are right. I can just use the Materials to look for a certain prefix. I just tried it with my two grass materials and it works perfectly. Both are named differently currently but I will use the same prefix for all the stuff I’m gonna add to the procedural foliage spawner in the future. I feel like this method also doesn’t have a lot of overhead to it, so it should work nicely.

This implementation is a quick test based on King Mango’s suggestion. It works nicely. Like now I’m checking for my two specific grass types but I will change it so all the grass has the exact same prefix in the future. This way I can add whatever I want to the procedural foliage spawner and have it either be removable or not depending on the prefix of the material instance.