Description

When BlueprintGetter / BlueprintSetter specifiers are used for a property, the increment/decrement nodes in blueprints will call the BluprintGetter function but not the BlueprintSetter function. This results in the increment/decrement not affecting the property value.

Steps to Reproduce
  1. Open UE4 Editor (any project)
  2. Add code based on Actor (MyActor)
  3. Add the following to MyActor.h:
    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test, BlueprintGetter=GetMyValue, BlueprintSetter=SetMyValue)
    		float MyValue;
    
    	UFUNCTION(BlueprintGetter, Category = Test)
    		float GetMyValue() const;
    
    	UFUNCTION(BlueprintSetter, Category = Test)
    		void SetMyValue(float SetValue);
    
  4. Add the following to MyActor.cpp:
    void AMyActor::SetMyValue(float SetValue)
    {
    	MyValue = SetValue;
    if (GEngine)
         {
    	GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::MakeRandomColor(), TEXT("On Set Text"));
         }
    }
    
    float AMyActor::GetMyValue() const
    {
         if (GEngine)
         {
    	GEngine->AddOnScreenDebugMessage(-1, 4.f, FColor::MakeRandomColor(), TEXT("On Get Text"));
         }
         return MyValue;
    }
    
  5. Compile
  6. Create blueprint based on MyActor (MyActorBP)
  7. Add GetMyValue node and drag off return pin to create increment node
  8. Wire BeginPlay into Increment node - wire Increment node into Print String node
  9. Wire GetMyValue node into Print String
  10. Compile blueprint and set default value for MyValue to 100
  11. Add instance of MyActorBP to the viewport
  12. PIE

Result:
"On Get Text" is printed twice (once for increment node, once for print string node), but the "On Set Text" is not printed. The value printed by PrintString node is 100, indicating the increment did not update the property.

Expected:
Calling increment node from Getter node updates the value returned by Getter

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-51817 in the post.

1
Login to Vote

Won't Fix
ComponentUE - Gameplay - Blueprint
Affects Versions4.17.24.18
CreatedOct 31, 2017
ResolvedAug 18, 2021
UpdatedAug 18, 2021
View Jira Issue