Adding a UFUNCTION to my UObject Plugin causes build to fail.

Am I not able to have UFunction capabilities with my plugin? The moment I delete the UFUNCTION it build perfectly fine. The error I am getting:

25>ERROR : UBT error : Failed to produce item: C:\Unreal Source\Unreal 7-13-15\I\Engine\Plugins\Developer\UFileImporter\Binaries\Win64\UE4Editor-UFileImporter.dll 25> Total build time: 43.02 seconds 25>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command "..\..\Build\BatchFiles\Build.bat UE4Editor Win64 Development" exited with code -1.

Please post the related code

UCLASS(BlueprintType)
class UMyFileImporter : public UObject
{
GENERATED_UCLASS_BODY()

public:
	UFUNCTION(BlueprintCallable, Category = "Import")
	//UFUNCTION()
	void Import(const FString Path);
private:

};

Would plugins be able to find classes like UTexture2D or UMaterials?

Hey

When you say you delete the UFUNCTION are you referring to the commented section of what you posted or the line above that?

UBT is failing for some reason. Or the linker is failing, or something like that. If you could post more of your build log, that would be useful. But you could first try fixing your function declaration, because it’s a bit unusual.

void Import(const FString Path);

Should be changed to

void Import(FString Path);

or

void Import(const FString& Path);

You don’t need to pass a value type as const. You probably meant to pass it by const reference.

I had tried out both to see if it would make a difference but it didn’t. For either one, they both still cause the error

Hey

I’m still investigating what could be causing the compile to fail for you however I need more information to make sure I’m understanding what is going on clearly. Could you post the entire output log from when the compile failed? Additionally could you post the full header for the plugin?

It may be that you will have to add dependency for “CoreUObject” to the .cs file for your plugin. You may also need to make sure that an #include of the .generated.h is added. You’ll also need to add the *_API markup on the class or method if you are exposing this to the editor in any way. These suggestions are worth testing if you have the chance however more information will help narrow down the cause.

Cheers

I think there was something wrong with my .cs file. I just retyped everything in there and it started working. Maybe something was misspelled