Iterate all blueprints derived from a class

Title says it all.

There was a post here, but was closed before the an answer come up.

It’s been 2 years, I’m hoping there’s some update to this ?

The Planed Get all Actors of Class Node is a actual thing now :stuck_out_tongue_winking_eye: unless you mean something else and the Title does not say it all.

Just noticed its also taged with C++ so here you go

TArray<AActor*> Found;
	UGameplayStatics::GetAllActorsOfClass(this, AYourClass::StaticClass(), Found);

Dont Forget to Cast to AYourClass if you want todo something with them =)

In C++ you can also use TActorIterator, which let you loop thru actors on the go, so if you searching for specific actor this let you save performance by breaking loop once you find it, doing operation on actor in that loop should also save a bit of performace, you can finds example of it here:

UGameplayStatics::GetAllActorsOfClass also use it, but it loop thru all actors of class and just put them in array

Sorry I wasn’t very clear, but what I need is not instantiated actors, but the blueprint assets, something like below for example

GetAllBlueprintsOfClass(UClass*, TArray<TSubclassOf<AActor>>& Actors);

Then use word “class”, blueprint is a class :stuck_out_tongue: i think i would be better if people don’t mention “blueprint” at all in such issue, it’s like calling “code” a “c++” insted. Lucky you i got anwser for that too ;] i post it now

Only way to do it is iterate thru all UClass object in memory and filter


for(TObjectIterator<UClass> It; It; ++It)
		&& !It->HasAnyClassFlags(CLASS_Abstract))   

Problem with it that is very heavy duty, when do this engine will freeze for moment (but not long around 3 sec max depending how many object there is in memory). So do this once in some more global class on start of the game (best would be when game loads), and always keep those findings in array. This is probably only way as i actully find this in engine it self, UE4 use this to list sound cue nodes.

!It->HasAnyClassFlags(CLASS_Abstract)) this part will let skip useless generic abstract classes like APawn

Oh you want that yeah than take Shadows Answer Im to late :smiley: had to draw pretty Pictures for another Post xD

Thanks you!