How do I add C++ functions to a VR project?

I’ve tried to add C++ functions to a VR project without success. I can compile the code without errors, but the functions never show up in the blueprint editor.

I followed the example of this tutorial It works for first-person projects, but not in my VR project.

I’ve also tried added C++ derived from Character, Actor, and BlueprintAsyncActionBase. None of them ever show up. I see them in the Visual Studio solution, but not in the Unreal editor.

Edit: this is an expansion of this previous question.

Thanks. I tried that, and had to rebuild the Visual Studio solution, which I did with UnrealVersionSelector.exe /projectfiles. Still didn’t see my C++ stuff in the blueprint editor. I don’t see the C++ stuff in the content browser either.

Yeah, here’s the header file:

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "TestFunctions.generated.h"

and here’s the .cpp file:

/**
 * 
 */
UCLASS()
class EC130_API UTestFunctions : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	
	UFUNCTION(BlueprintCallable)
	static FString HelloWorld();
	
};

#include "TestFunctions.h"

FString UTestFunctions::HelloWorld()
{
	return FString("Hello World");
}

I clearly don’t know how to format code in my comments, either.

edit: for multi-line code blocks, start each line w/ <TAB> or 4 spaces

  1. Ensure your project compiles.
  2. Close Unreal. Delete the folders called saved, intermediate, and binaries.
  3. Rebuild those derived files.
  4. If your library functions appear now, then the issue is related to hotreload/editor reflection.

And your functions are marked with UFUNCTION() Macro? And does the UFUNCTION() Macro work for actor component functions? Note that your functions in a library have to be static functions.

I’m using 4.25.0.

I added the Category, and still don’t see C++ function.

Press the 1010011 code sample button to format code. Try adding a category to the UFUNCTION. It should show up when you search the category. Additionally, what Ue4 version are you on? It seems you are gong things correctly. I am unsure why your function isn’t showing up.

Don’t want to answer my own question, but the answer is here. What I had to do was to add my project as a module in the .uproject file.