[C++]Why does unreal crashes when i use ActorIteration?

i followed this link and did everything exactly like in the tutorial but everytime i build it Ue4 crashes ?
A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine ForumsObject%26_Actor_Iterators,_Optional_Class_Scope_For_Faster_Search

Post your code please. :slight_smile:

AInventory::AInventory(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
for (TActorIterator ActorItr(GetWorld()); ActorItr; ++ActorItr )
{
UE_LOG(LogTemp, Warning, TEXT(“Found: %s”),*ActorItr->GetName());
}
}

You need to make a new function/method. Don’t call the iterator in the constructor method. :slight_smile: