I am creating a BP component to add to actors in my level. When an actor with the component is selected, the component has a function that looks at the actors components for static meshes to do various things (change material, set mesh, etc.)
The root of each actor is a static mesh component, and many have sub-components that are static meshes as well. My issue is that when I select some actors, the resulting function returns a sub-component mesh rather than my root mesh component.
My question is: How does GetComponentByClass identify the order in which components are returned? It does not appear to be hierarchical like I hoped.
I know I can use GetComponentsByTag, but this seems like it will be more expensive and I am developing for a mobile platform.
It doesn’t understand hierarchy. If the root component is what you’re after, you could call GetRootComponent and then cast it to a static mesh component.
I would imagine the cast would be in the noise for your situation while also producing more readable code/logic. Like always, performance testing is key to a question like that. Are you running this on tick or is this a oneshot?