4.7.2 Exposing function to blueprints

Very similar problem already tracked here [4.6 Hot Reload] UPROPERTY/UFUNCTION/BP Impl. Events do not show up after hot reload, Development Editor x64 - Programming & Scripting - Epic Developer Community Forums but closed as RESOLVED due no further investigation.

Detailed discussion is here Exposing function to blueprints? - C++ - Epic Developer Community Forums

I’m super noob and started playing around the engine just few days ago’, so please point me out if i made something wrong.

Mainly, following the tutorial here Programming with C++ in Unreal Engine | Unreal Engine 5.1 Documentation, some of us notice something going not in the right way. Seems to us that an explicit RESTART of the unrealengine editor is needed to see an update list of the UFUNCTIONs, with the right-click on blueprint editor.

version in use 4.7.2

os windows 7

visual studio 2013

1-open unrelaengine editor

2-open visual studio

3-rebuild code in visual studio

4-after rebuild terminated, unrealengine editor triggers HOTRELOAD

5-in blueprint editor, from right mouse botton, i’m able to see the function CalculateValues from Damage Category

6-change in visual studio the function CalculateValues from Damage Category to DamageTWO Category

7-rebuild code in visual studio

8-after rebuild terminated, unrealengine editor trigger HOTRELOAD

9-in blueprint editor,from right mouse botton, i’m NOT able to see the function CalculateValues from DamageTWO Category, even if something happens (the SETTER box highlight a label ERROR in red)

10-restart unrealengine editor

11-in blueprint editor, from right mouse botton i’m now able to see the function CalculateValues from DamageTWO Category, and SETTER box are without ERROR

HEADER:

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

UCLASS()
class MYPROJECT_API AMyActor : public AActor
{
	GENERATED_BODY()
	
public:	

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
		int32 TotalDamage;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Damage")
		float DamageTimeInSeconds;

	UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Transient, Category = "Damage")
		float DamagePerSecond;


	// Sets default values for this actor's properties
	AMyActor();

	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

	virtual void PostInitProperties() override;

	void  PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;

	UFUNCTION(BlueprintCallable, Category = "Damage")
		void CalculateValues();
};

SOURCE:

// Fill out your copyright notice in the Description page of Project Settings.
    
    #include "MyProject.h"
    #include "MyActor.h"
    
    // Sets default values
    AMyActor::AMyActor()
    {
    	TotalDamage = 200;
    	DamageTimeInSeconds = 1.f;
    }
    
    // Called when the game starts or when spawned
    void AMyActor::BeginPlay()
    {
    	Super::BeginPlay();
    }
    
    void AMyActor::PostInitProperties()
    {
    	Super::PostInitProperties();
    	
    	CalculateValues();
    }
    
    void AMyActor::CalculateValues()
    {
    	DamagePerSecond = TotalDamage / DamageTimeInSeconds;
    }
    
    #if WITH_EDITOR
    void AMyActor::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
    {
    	CalculateValues();
    
    	Super::PostEditChangeProperty(PropertyChangedEvent);
    }
    #endif

Hey enigmahc-

I was able to reproduce the problem you mentioned with the UFUNCTION() macro and have reported the bug to our internal tracking database (UE-11623) for further investigation. For the time being the simplest workaround does seem to be to simply close and reopen the editor. Best of luck in your project.

Cheers