Download

How to Reference a Static Mesh Actor that is in a BP

Hi everyone,

The screenshot shows my current setup. I’m highlighting objects to mark them out for interaction using the tag ‘Item’. The highlight is working on static meshes but isn’t when I apply the ‘Item’ tag to BP actors. I’m tagging actors from the main editor screen (using the Details pane). I’ve tried this for BPs and I’ve also tried it from inside the BP class defaults pane. I’ve tried tagging them separately and together.

I think there’s a gap in my understanding of the Actor Class, which is set to Static Mesh Actors - I’m guessing this doesn’t dig into BP classes?

Oh - I’m also unable to highlight merged actors using this method.

9d014be416f633a49a1720f9462c1e41a8b47ff8.jpeg

You probably want to call GetAllActorsOfClass on the ActorClass “Actor” instead of “StaticMeshActor”. Do you think StaticMeshActors are all Actors with StaticMeshComponents? They are not. You cannot access a StaticMeshComponent that way like you’re currently doing but you can call GetComponentsOfClass with the class “StaticMeshComponent”, loop over the returned array and SetRenderCustomDepth on each of that array elements.

In addition calling ActorHasTag with a tag in the array of tags of the actor the function is called on is pointless. This actor will always have that tag and therefore the result will always be true. I guess you want to call it on the tag “Item” instead.

At last I hope you don’t execute these nodes within EventTick. GetAllActorsOfClass isn’t a node you want to call each tick.

Thanks for the response.

No, I don’t think that :wink: I’m piecing together several different blueprints I’ve found to try to get the result I’m after.

ActorHasTag updated to call ‘Item’ - thanks.

I was executing with EventTick… that won’t matter now, if I can do this without calling all actors of class.

So this is my new setup but now I’m unsure how to complete my Targets in GetComponentByClass and GetDistanceTo? Thanks

c290940d51ace20097ee2746e955679155c8fe8b.jpeg