Retrieve an Actor spawned by ChildActorComponent


I have a C++ Actor: RPSCharacter. One of its variables, SpeechTextRender is a TextRender pointer. On begin play, the character checks if it has a TextRenderer component attached. If so, that component is saved to SpeechTextRender. If not, a component is spawned and then saved to SpeechTextRender.

I have created a blueprint, BillboardText, which is an empty object with a single TextRender that faces the camera on tick.

I have another blueprint that inherits from RPSCharacter called RPSCharacter_Patrol. I am attempting to attach one of these BillboardText actors to it and have RPSCharacter find its TextRender component. To do so I am using a ChildActor component in RPSCharacter_Patrol.

The BillboardText is spawning correctly, but the RPSCharacter cannot find it. I have tried iterating through children, but this->Children is always empty, even after the game has started.

How can I ensure that RPSCharacter can find a TextRenderComponent somewhere in its hierarchy?

Caveat, may be a different situation, but it appears to be the same thing I ran into last week. In my case, I have a pointer to a blueprint I spawn containing a series of waypoint transforms which are ChildActorComponents. These ChildActorComponents have TargetPoint set as their Child. They spawned in the hierarchy as if children, but could only be referenced as UActorComponent. In the outliner, they show as children with the appropriate type (in my case TargetPoint) you can’t click on. You can only manipulate them by going to the component in the details panel. I was able to access them in code by iterating through the components and finding them by name. In my case, these components were named with Waypoint in their GetName().

In my use case below, blah is the pointer to the component that has a child which is a target point. So to use the pointer to that child, you would use blah->GetChildActor().

        Waypointptr = GetWorld()->SpawnActor(WaypointActor);
        TArray<UActorComponent*> TPComps;
        for(int i=0;i<TPComps.Num();i++) {
            if((TPComps[i]->GetName().Contains(TEXT("Waypoint")))) {
                UChildActorComponent* blah=Cast<UChildActorComponent>(TPComps[i]);
                if(blah) {
                     UE_LOG(LogTemp,Warning,TEXT("Child Actor is: %s"),*blah->GetChildActor()->GetName());

The output of the UE_LOG here is:

LogTemp:Warning: Child Actor is: TargetPoint_0
LogTemp:Warning: Child Actor is: TargetPoint_1
LogTemp:Warning: Child Actor is: TargetPoint_2