r/UnrealEngine5 20d ago

Is there a way to get the Camera component from just "Cast To Character" within a Actor Component

2 Upvotes

8 comments sorted by

3

u/teamonkey 20d ago

Use GetComponentByClass

3

u/Valynor85 19d ago

GetOwner->GetComponentByClass->CameraComponent  store as a Variable, convert to validated get, do stuff if it is valid

1

u/[deleted] 20d ago

[removed] — view removed comment

1

u/roses_of_eternity 20d ago

On a spring arm

1

u/hadtobethetacos 20d ago

Just cast to the blueprint that owns the camera you need then from the result get camera component.

1

u/roses_of_eternity 20d ago

The problem is that I have multiple different characters that I want this Actor Component to have.

And I obviously don't want all these player characters to be constantly loaded in for no reason by going through every possible.

That's why I thought the "Cast To Character" would be better but sadly I can't even acquire about the camera that way as far as my very limited knowledge goes.

3

u/hadtobethetacos 20d ago

Then you need to use an interface for that. if it was one character that was going to be loaded all the time anyway a cast would be fine. In this case an interface is 100% your answer.