I needed to do it like this to be able to use nodes like (SpawnAIFromClass, SetTimerByFunctionName), because the GetLevel() didn't work and threw a Warning
UWorld* UWorldObject::GetWorld() const {
// CDO objects do not belong to a world
// If the actors outer is destroyed or unreachable we are shutting down and the world should be nullptr
if (!HasAnyFlags(RF_ClassDefaultObject) && ensureMsgf(GetOuter(), TEXT("Actor: %s has a null OuterPrivate in AActor::GetWorld()"), *GetFullName())
&& !GetOuter()->HasAnyFlags(RF_BeginDestroyed) && !GetOuter()->IsUnreachable())
{
return GetOuter()->GetWorld();
}
return nullptr;
}