Template/Wildcard return type for Blueprints

Hey Guys, I figured this one out. I stumbled across this thread while searching for the answer myself, so though I should put in down here for all to see.

As with everything in Unreal, it’s solved using a meta specifier, in this case it’s DeterminesOutputType

UFUNCTION(BlueprintCallable, meta = (DeterminesOutputType = "actorClass"))
class AActor* SpawnActor(class TSubclassOf<class AActor> actorClass);

As you can see the DeterminesOutputType = “actorClass” is pointing to the parameter of the same name “actorClass”. This will morph the returned AActor* that was passed in.

258962-capture.png

Hope this helps!
~GameQ

7 Likes