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.
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);
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; }
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
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-51817 in the post.
1 |
Component | UE - Gameplay - Blueprint |
---|---|
Affects Versions | 4.17.2, 4.18 |
Created | Oct 31, 2017 |
---|---|
Resolved | Aug 18, 2021 |
Updated | Aug 18, 2021 |