Search code examples
unreal-engine4unreal-blueprint

Unreal 4.25 - cannot use "GetAllActorsOfClass" in "Object" class based blueprint


I try to make a blueprint that does not have a 3D representation in the game world

I used "Object" as the base class

but now I cannot find/use GetAllActorsOfClass in the blueprint editor (even when disabling context sensitivity)

now I may have been to far up the class hierarchy

I cloned the unreal repository but I can't figure what is the minimum base class to use to have access to GetAllActorsOfClass

any help appreciated on this

ed


Solution

  • The GetAllActorsOfClass node is a call into UGameplayStatics::GetAllActorsOfClass. This function requires a world context. UObject does not provide a world context by default - i.e. a call to UObject::GetWorld is not guaranteed to be successful.

    Use Actor as your base class. It will not have a 3d representation if you don't add any renderable components.