Garbage collection is not nulling my pointers?

I was testing out what happens when I destroy actors and mark objects for garbage collection. All the documentation seems to say that one of the benefits of the UPROPERTY system is that it will automatically set references to GC’d objects to null. I am not seeing this happen in my testing? Can someone tell me what I am doing wrong?

Header:

UCLASS()
class MY_API AMainActor : public AActor
{
   GeneratedBody()
...
    UPROPERTY(EditAnywhere)
    ATestActor* TestActor;

    UPROPERTY(EditAnywhere)
    TArray<UTestObject*> TestObjects;
}

Source:

// Begin play
TestActor = static_cast<ATestActor*>(GetWorld()->SpawnActor(ATestActor::StaticClass()));

TestObjects.Add(TestActor->TestObject);


// Somewhere else in code
// Bound pressing a button to destroy
TestActor->Destroy();
EmptyObjects[0]->MarkPendingKill();


// Somewhere else in code
// Bound pressing a button to check if null'd
if(TestActor == nullptr)
    // Not null'd

if(EmptyObjects[0] == nullptr)
    // Not null'd

The resource I am going based on:

When an AActor or UActorComponent is destroyed or otherwise removed from play, all references to it that are visible to the reflection system (UProperty pointers and pointers stored in Unreal Engine container classes such as TArray) are automatically nulled.

You must never use static_cast with UObject, if you want to cast to a specific type after an actor spawn you use this :

TestActor = GetWorld()->SpawnActor<ATestActor>();

Otherwise use the Cast<T>(Object) function if you want to cast an UObject, and I guess your issue come from this.

Can you stop posting the same question. I answered your previous question, and you post and open a new one with the same topic. Reported.

My bad, this first question error’d out when I posted it so I assumed it never got uploaded. Also in my profile it said I had 0 questions up.

Post in question with an answer from me; https://answers.unrealengine.com/questions/974647/view.html

I already answered and told him this on his previous post for the same question! https://answers.unrealengine.com/questions/974647/view.html