Accepted parameter types of C++ functions exposed to Blueprints

When I expose functions I write in C++ to Blueprints by adding UFUNCTION(BlueprintCallable) above it - can the function take parameter types that are not primitive types (int, char, float etc) or Unreal’s own types (FString etc)?

Example of what I want:

void SomeFunction(std::string name, const char* anotherName, MyCustomType myType);

I can’t get this to work, maybe this is by design?

Blueprints use Unreals types so replace std::string with FString& Name, consider making const char const FName& AnotherName
and make MyCustomType (assuming your own data structure) a USTRUCT with UPROPERTY marked variables so they can be accessed through blueprint.

First: FName is a bad replacement for std::string. FName is for identifying strings that might need to be made unique, so you can tack on numbers on them. For the typical use of string, use FString, and for user-readable text, use FText.

Second: You can pass in your own types, as long as they are also known to the Unreal system. Thus, if you define a FYourStruct with USTRUCT() then you can pass that in, and you very frequently pass around AYourActor * to point at actors, although you can use any UYourObject * class derived from UObject. You generally don’t want to pass the actors/objects by reference, though, but for structs it’s generally OK.

FName for const char* replacement

VM functions only support types exposed as a Unreal Type:

FName isn’t good as char* replacement, either.

Use FString, unless you’re literally dealing with “the unique code-assigned name of an object in the scene.”

Use FText if the end user will read the message.