Plugin in Blueprints

Hi!

Since the engine does not have any direct support for joysticks, I wrote a plugin that can access joysticks via SDL library. As usual, the plugin is inherited from IModuleInterface and I have an object inherited from UObject. I want to access the functions of the plugin, but I can’t. However, I can add the object inherited from UObject in the blueprints and call its functions. How can I enable plugin functions in blueprints ?

Thanks!

How about creating a blueprint function library (BFL)? Functions that you put in BFL are usually static and can appear as nodes in any BP. It usually goes like this:

header:


#pragma once
#include "Engine.h"
#include "TestBPLibrary.generated.h"

UCLASS()
class UTestBPLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()

	UFUNCTION(BlueprintCallable, Category = "Testing")
	static float TestSampleFunction(float Param);
};

.cpp


#include "TestBPLibrary.h"

UTestBPLibrary::UTestBPLibrary(const FObjectInitializer& ObjectInitializer) 
: Super(ObjectInitializer)
{

}

float UTestBPLibrary::TestSampleFunction(float Param)
{
	return -1;
}



Hope this helps

Well it definitely helps. Looks like the best thing to do is move the methods I declared in IModuleInterface to UBlueprintFunctionLibrary.

Thank you very much.

1 Like