IsValidLowLevel or != nullptr??

What am I supposed to use?

UPROPERTY(VisibleDefaultsOnly, BlueprintReadOnly)
AActor* ActorToCheck;

//1
if(ActorToCheck->IsValidLowLevel())

//2
if(ActorToCheck != nullptr)

Pretty sure 2 because 1 would call a null pointer exception?

I’ve shipped 5+ products with the engine and never really used IsValidLowLevel() for anything.

neither, use implicit cast to boolean

if (ActorToCheck)
{
}

Comparing to nullptr can also work in many cases, and may even be preferred in some rare cases, but there are risks to be aware of.

Since the variable is UPROPERTY, it will automatically be set to nullptr when object is freed from memory.

For actors, that doesn’t mean immediately upon Destroy() call. When destroying actor, the memory object is marked for destruction, but kept in memory until next GC pass (which should happen within the next 30 seconds or so).

During that time, actor is considered invalid but its memory is still valid, and your variable still points to it, so it is not nullptr. Reading properties in memory, and calling basic c++ functions should still work. However, attempting to run blueprint functions (BlueprintImplementable or BlueprintNative), or triggering delegates / dispatchers, may result in errors or crashes.