Need help with GetAllActorsOfClass() in a static function library

There’s a typo in your function signature (both the declaration and definition)

You’ve written the return type as

TArray<AMasterCell>

when it should be

TArray<AMasterCell*>

As for the other issue which you worked around, within a static function you cannot use a non-static variable because you need an instance, an actual object of type UMyBlueprintFunctionLibrary from which to extract the variable. An instance of a BP library would of course, be illogical.

In any case I’d consider whether you really want to make MasterCellClass a member variable (static or otherwise) of the library. This is not how BP libraries are conventionally used.

If you look at KismetSystemLibrary.h for example, these are meant to be used a collection of static functions that are self-contained and can be conveniently called from blueprints or C++. Perhaps considering making mastercellclass a parameter.