Did a bit more research, for some reason this error occurs only when using an array of UClass* within a UFUNCTION declaration. All other combinations (such as return an array of some other UObject type, or having a UClass array property) seem to be valid. I’d suggest filing a bug report, I suspect it’s not intentional.
Anyway, for whatever reason, if you use TArray< TSubclassOf< SomeBaseClass > >
instead, it seems to work. TSubclassOf is a simple template wrapper around a UClass* which adds a bit more type safety. If you don’t want to restrict the classes which can be assigned to it, then the direct equivalent of UClass* is simply TSubclassOf< UObject >
, since UObject is the root of the hierarchy.