C++ Parent function not displaying in the blueprint editor

I’ve made a very simple BaseCharacter C++ class with getters and setters (And some other functions) for Health and Mana so that I can use it on AI characters and player characters alike.

Now the strange part is that it does not allow me to search for my functions anymore in my blueprint. (It did before, because I’ve managed to add them into my blueprint before. (See pic below) They simply won’t display in the searchbar when adding a node in the blueprint editor anymore when I try to search for them.

However, the blueprint does recognize the functions that I previously added already. These functions work as well (function the way they are supposed to in-game) Copy pasting the existing function nodes of the parent that are in the blueprint already works as well and when I re-parent the blueprint it will also give an error on these existing functions because they won’t be linked anymore.

I’ve looked here and on the forums quite a bit and found somewhat similar questions, but nothing really helped.

Really pulling my hairs over on this. Would really appreciate some help.

Code: (Even though that doesn’t seem to be the issue, considering the functions definitely work…)

Public:

UFUNCTION(BlueprintSetter)
void SetHealth(float NewHealth);
UFUNCTION(BlueprintGetter)
float GetHealth();
    
UFUNCTION(BlueprintSetter)
void SetMana(float NewMana);
UFUNCTION(BlueprintGetter)
float GetMana();

UFUNCTION(BlueprintSetter)
void AddHealth(float HealthModifier);
UFUNCTION(BlueprintSetter)
void RemoveHealth(float HealthModifier);

UFUNCTION(BlueprintSetter)
void AddMana(float ManaModifier);
UFUNCTION(BlueprintSetter)
void RemoveMana(float ManaModifier);

Here’s an image of my blueprint, displaying the parents functions that I previously added:

But now all of a sudden it doesn’t display when I try to search for it at all:

1 Like

Problem seems to be that, previously I used UFUNCTION(BlueprintCallable) (before changing it to BlueprintSetter), which made it display in the editor, however, it couldn’t change the data in the C++ class. Changing it to BlueprintSetter did allow me to change the data, but removed it in the display in the editor.

However, apparently I was using the BlueprintSetter (and getter) wrong. Proper way to use it is:

private:
	//Base health
	UPROPERTY(EditAnywhere, BlueprintSetter = SetHealth, BlueprintGetter = GetHealth)
	float Health;

	//Base Mana
	UPROPERTY(EditAnywhere, BlueprintSetter = SetMana, BlueprintGetter = GetMana)
	float Mana;

public:
    UFUNCTION(BlueprintSetter)
	void SetHealth(float NewHealth);
	UFUNCTION(BlueprintSetter)
	void SetMana(float NewMana);

	UFUNCTION(BlueprintGetter)
	float GetHealth();
	UFUNCTION(BlueprintGetter)
	float GetMana();

	UFUNCTION(BlueprintCallable)
	void AddHealth(float HealthModifier);
	UFUNCTION(BlueprintCallable)
	void RemoveHealth(float HealthModifier);

	UFUNCTION(BlueprintCallable)
	void AddMana(float ManaModifier);
	UFUNCTION(BlueprintCallable)
	void RemoveMana(float ManaModifier);

In the blueprint editor it will display as a regular setter and getter now. Other functions such as RemoveMana just needed the BlueprintCallable keyword(?).

220412-untitled.png

Source:
https://forums.unrealengine.com/unreal-engine/feedback-for-epic/123697-going-beyond-awesome-with-blueprints

1 Like