Hi everyone,
I’m creating an Editor Utility Widget to display a list of actors of a specific class or implementing a specific interface, and show some information related to them (the actual implementation is not important).
The problem comes when I need to read that information. To get access to the actors, I’m currently using this:
TArray<AActor*> FoundActors;
UGameplayStatics::GetAllActorsOfClass(GetWorld(), AActor::StaticClass(), FoundActors);
But I retrieve no information.
The blue is the list of objects I want to read the information, but it’s empty. The Red are some variables I exposed to better some of the info I need.
However, if I use the selected actor method with this code:
C++USelection* SelectedActors = GEditor->GetSelectedActors();
TArray<AActor*> Actors;
TArray<ULevel*> UniqueLevels;
for (FSelectionIterator Iter(*SelectedActors); Iter; ++Iter)
{
AActor* Actor = Cast<AActor>(*Iter);
if (Actor)
{
FoundActors.Add(Actor);
}
}
I get all the info I want.
I used the same workflow as before, but here I have everything I want.
Honestly, I can’t figure out why this is happening. For more context, I’m executing an Editor Utility Widget from a Toolbar button in a PIE session since it’s during game time that the information I need is available.
Do you know why this is happening and how I can fix it? I basically need a way to get all the actors I need in the level.
Thank you in advance to everyone .