C++ Blueprint Function Library functions not showing up in blueprint editor

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!");
}

So, apparently the functions were working the whole time… for “normal” blueprints. However, I had wanted to use them in a material and apparently some functions just aren’t allowed in materials for no practical reason. I suppose the only solution is to remake the exact same thing as a blueprints-only “material function,” which goes against my coding style senses but it’s better than nothing.

1 Like

Keep in mind that the BPs are not materials nodes.

The material editor is basically a visual shader editor, there is no concpet of BP or classes, your materials are also run on the GPU and not the CPU.

If you need to expose something within the material editor you can either use parameters that you set from a BP (or C++) or you build your own material nodes (shader code) that handle more complicated stuff. In either way the data must be provided from the outside of your material itself.

Ah, I was under the impression that since both blueprints and materials use the same visual editor, they would be able to share all the same functions…