Accepting Arrays of any type in unreal c++

How do I write a UFunction that accepts an array of any type as an argument. In normal c++ I would be able to use templates but unreal engine throws an error when templates are used. Is there an equivalent to templates in unreal c++?

Here is a simple example of what I have tried.

class Test UFunctionLibrary : public UBlueprintFunctionLibrary

	UFUNCTION(BlueprintCallable, Category = "Custom", meta = (Keywords = "HelperMethods"))
            template <typename T>
	static bool CheckIfEmpty(TArray<T> objectArray)
                   return true;
                  return false;


When compiling I get an error stating template is an unrecognized type and must be a UCLASS, USTRUCT, or UENUM.

In case nobody comes around with an actual answer, there are functions in the engine that uses templates and returns generic types at least. You could dive into one of those functions to get inspiration.


UHT can’t parse templates apart from a few exceptions, so you can’t use them with Blueprint.

Take a look at KismetArrayLibrary. The short answer is that you create a special Wildcard pin, then implement the parameter parsing and blueprint code yourself.