So, I’ve finally started doing some C++ work because I wanted to do some stuff that’s apparently not possible in pure scripting or at least less neat.
As a starting point, I created a Function Library according to a few tutorials that I found online and created a few dummy functions to test the functionality first.
Now, my issue is that, after compiling, (which, by the way, behaves very erratically and often throws out errors for code that it compiles perfectly fine on a second attempt) I don’t see the functions anywhere in my blueprint context menu and neither do I see them in the “Palette” view. Yes, I also tried to uncheck “context sensitive”.
I only have a header right now, because I am assuming that an actual implementation of the functions is not strictly necessary to make the them appear in the editor, as doing an implementation while testing in another project didn’t help either. If an implementation actually is required, it would be nice to know, though.
I made three functions to test if any of the blueprint-related parameters would produce different results, and also tested if making the functions explicitly static would change anything. Which it does, by giving me a “error C2352: ‘UObject::FindFunctionChecked’: illegal call of non-static member function” error, even though the tutorials do use the static keyword.
The Enum also doesn’t appear, but I’m not sure if it’s supposed to or if there’s even a way to include a C++ Enum on the blueprint side. The library is in the root folder of the C++ classes list.
The shared category of Enum and the functions shouldn’t be the cause of the issue, as I originally didn’t have a category for the former.
#pragma once
#include "Kismet/BlueprintFunctionLibrary.h"
#include "BPFunctions.generated.h"
/**
*
*/
UENUM(BlueprintType, Category = "PowerUp")
enum Boosts
{
Speed,
Jump,
Strength
};
UCLASS()
class GROWTH_API UBPFunctions : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintImplementableEvent, Category = "PowerUp")
static void PowerBoost(Boosts Type, float Value);
UFUNCTION(BlueprintCallable, Category = "PowerUp")
static void PowerBoost2(Boosts Type, float Value);
UFUNCTION(BlueprintNativeEvent, Category = "PowerUp")
static void PowerBoost3_(Boosts Type, float Value);
};
I have seen a few posts on the topic of this issue, but most resolved with a “I restarted the editor”, which doesn’t work for me.
In fact, I tried this in two UE versions of the same project, as well as a newly created project just for testing this one thing. As an aside, in the 4.11 version of my current 4.12 project, using the “New C++ class” functionality made a file that doesn’t appear in the content browser, while the 4.12 version had no such issue.