I’m trying to make a few functions (eventually to generate an “ocean” material but I’ll cross that bridge when I get there) in C++ to use with blueprints. I created a simple class derived from BlueprintFunctionLibrary, added a UFUNCTION that takes no arguments are merely returns the string “Hello World!” to check that it worked. However, after compiling it didn’t show up in the blueprint editor. I’ve found several forum threads and questions with similar issues to mine, but after trying their solutions my function is still nowhere to be found. The most common solution is to simply close and relaunch the editor, which I’m now doing every time I compile, but it doesn’t make a difference.
I’m sure it’s a newbie mistake, but I’ve been pulling my hair out for hours over this so I gave up and decided to ask here.
TestLibrary.h:
#pragma once
#include "Kismet/BlueprintFunctionLibrary.h"
#include "TestLibrary.generated.h"
/**
*
*/
UCLASS()
class BOATGAME_API UTestLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(BlueprintCallable, Category = "TestLibrary")
static FString HelloWorld();
};
TestLibrary.cpp:
#include "BoatGame.h"
#include "TestLibrary.h"
FString UTestLibrary::HelloWorld() {
return FString("Hello World!");
}