Is there a way to get actor component without the actor reference?

So thats where the system design comes in.

If your actors with that component is specifically doing something, that component can register itself somewhere.

EX:

ItemActor->OnBeginPlay->GetPlayerCharacter->AddToArrayUnique OfRegisteredComponents
ItemActor->OnBeginDestroy->>RemoveFromArrayUnique OfRegisteredComponents

That way you don’t have to search actors of a class everytime, you can just ask the array which holds components. So its more efficient also more contained.

A subsystem would be suitable for that. It’s not hard I suggest code some C+ if you don’t since you will need anyway if you are a solo dev.

4 Likes