C++ FunctionLibrary error in Blueprint

“Target” should pin points to object on which the function is called on, it is required to plug somthing to it or else VM won’t know to which object call a function. If you want to create function not realted to object of this class you need to create static function, you only need to add “static” to function decleration in header file:

 UFUNCTION(BlueprintCallable, Category = "Test")
 static UObject* GetDefaultObject(TSubclassOf<UObject> ObjectClass);

This way Target pin will disapper and you won’t need to deliver any object

Hi,

I just got a problem with a FunctionLibrary.
This is the fist time I tried create a new one and I’m new to programming in general so I’m going to describe exactly what I did:

1: I went to File > Add Code to Project and choose Blueprint Function Library.

2: I added the following code to the library:

header:

UFUNCTION(BlueprintCallable, Category = "Test")
		UObject*GetDefaultObject(TSubclassOf<UObject> ObjectClass);

C++:

UObject* UMyFunctionLibrary::GetDefaultObject(TSubclassOf<UObject> ObjectClass)
{
	return ObjectClass->GetDefaultObject();
}

The node can now be used in a Blueprint.
But when I try to compile I get an Error:

I have found the Code for the Function in the Internet but it was only the C++ part. So I tried to do the rest on my own.

I’m a little confused now.
Maybe you can tell me, what I have done wrong.

Thanks it worked:)