I have various actors of c++ class Room, each with their own set of attached child actor components of c++ class RoomExit. I want to get the list of RoomExits from a given instance of Room, and be able to use the functions I’ve written in RoomExit.cpp.
I can call GetAttachedActors() on a parent Room actor to correctly get a list of the attached exit actors, but these come as AActor pointers, not ARoomExit pointers.
How can I get this list of actors as their appropriate actor subclass?
TArray<AActor*> AttachedActors;
RoomActorInstance->GetAttachedActors(AttachedActors);
for (AActor* Attached : AttachedActors)
{
ARoomExit* Exit = Attached;
int dir = Exit->GetBaseDirection();
}
This is my non-working code, where I am not able to set Exit=Attached, because they are of different classes.