CDO's OwnedComponents list is empty

It appears that CDO OwnedComponents arrays are not being correctly populated, and any calls made to GetComponents() on a CDO will return an empty TSet. This breaks the method used to get an object’s default components from the CDO.

Consider the following example code:



    void TestCDOGetComponents()
    {
        for (TActorIterator<AActor> ActorItr(GWorld->GetWorld()); ActorItr; ++ActorItr)
        {
            AActor* CDOActor = CastChecked<AActor>( ActorItr->GetClass()->GetDefaultObject());
            TSet<UActorComponent*> CDOComponents = CDOActor->GetComponents();
            UE_LOG(LogTemp, Warning, TEXT("%d"), CDOComponents.Num());
            for( UActorComponent* Component : CDOComponents)
            {
                UE_LOG(LogTemp, Warning, TEXT("%s"), *Component->GetName());
            }
        }
    }


This should print the number and name of each of the CDOs associated with every object in the world, however it will only print 0 for each object as CDOActor-&gt;GetComponents() will always return an empty TSet.

This is used in ActorRecording.cpp and appears to be the cause of UE-42309 as the ShouldRemovePredicate inline class (line 134) will always return true causing SyncedTrackedComponents to fail to populate the TrackedComponents array.

https://answers.unrealengine.com/questions/579951/cdos-ownedcomponents-list-is-empty.html