Get component by class --> Class hierarchy (Blueprint)

I noticed something weird when to use the
“Get component by class”.

I was trying to attach an actor to a component.

8

So I directly searched for a scene component (it didn’t work)

Then I tried to search for a primitive component (it didn’t work)

Finally I looked for an actor component and I cast it to scene component. (it worked)

So… i think something is wrong

Source (Class hierarchy):

https://app.creately.com/d/fZknuArLuyk/view

what is wrong? am I?, the hierarchy?, or the function?

Thank you so much!!

You won’t be able to cast an ActorComponent to a SceneComponent, since a SceneComponent inherits from an ActorComponent.

image

Also, you can’t attach anything to an actor component.
You should use a SceneComponent or its descendants.

My Products

1 Like

Ok, so the class diagram is correct.
The function must be wrong then. It should not fail when looking for a SceneComponent that is in fact the type of the component i were looking for with the “SocketBlue” tag.

I hope the devs fix that.

Thank you very much for your reply!! :sparkling_heart:

Perhaps the actor does not have components with this tag. Sometimes developers add tags to an actor instead of a component. Check it.

Yes, it does have the tag. I am the developer, I put the tag in the component. And it works in the way that I show in the image. The problem is that the function can’t find a SceneComponent with that tag. The function thinks it is an actor component.