Bug? AActor::GetComponents does not include child actor's components if used for a base class of UChildActorComponent

If the component type one is searching for when using AActor::GetComponents(TArray<T*, AllocatorType>& OutComponents, bool bIncludeFromChildActors = false) const is a parent class of UChildActorComponent, this function fails to properly recognize child actor components.

For instance:

TInlineComponentArray<USceneComponent*> array;
GetComponents(array,true);

Will not list any components on child actors, as UChildActorComponent derives from USceneComponent. The issue is, that a component of the actor is only checked for being a UChildActorComponent if it cannot be cast into the type of component one is looking for.

In UE 4.17.2 the relevant line is Actor.h:2740.

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://forums.unrealengine.com/unreal-engine/announcements-and-releases/1410408-unreal-engine-bug-submission-form

Thanks