Description

Summary

When Blueprint reads a C++ UPROPERTY that has a native UHT Getter, the Blueprint VM skips the getter and reads the raw backing field on two paths:

  1. Implicit LWC casts: a float property feeding a double/real pin (FloatToDouble), or a double property feeding a native float param (DoubleToFloat).
  2. Native by-reference params: const T& and UPARAM(ref) T&, for every type, int32 included.

The value is wrong and nothing reports it. Same-type by-value reads call the getter correctly.

Reproduced in the editor on //UE5/Main (5.9.0, CL 61286245). The code is unchanged at head in //UE5/Main, //UE6/Main, Release-5.9 and Dev-Release-5.9.

This is not a regression. Native getter support (CL 19147839) arrived after the cast opcodes, and the cast opcodes and StepCompiledInRef were never updated for it.

Root cause (from code; confirmed by repro and A/B tests)

Path 1: LWC casts

  • KismetCastingUtils.cpp:219-258 inserts KCST_FloatToDoubleCast / KCST_DoubleToFloatCast. These are emitted as EX_Let <temp> EX_Cast CST_FloatToDouble|CST_DoubleToFloat <EX_InstanceVariable> (KismetCompilerVMBackend.cpp:2116-2146).
  • UObject::execFloatToDoubleCast / execDoubleToFloatCast (ScriptCore.cpp:4072-4100) call Stack.StepAndCheckMostRecentProperty(Stack.Object, nullptr), then reinterpret_cast Stack.MostRecentPropertyAddress.
  • execInstanceVariable (ScriptCore.cpp:2371-2376) calls the getter only if (RESULT_PARAM), through FProperty::CopyCompleteValueToScriptVM_InContainer -> CallGetter (Property.cpp:944-955). With a null result the getter never runs, and the cast reads the raw field.
  • History: the null-result step is the None-context guard from CL 18854053 ([Link Removed]). The raw read is from CL 20560449 ([Link Removed]). Both predate getter support.

Path 2: by-ref native params

  • P_GET_PROPERTY_REF -> FFrame::StepCompiledInRef (Stack.h:505-524) steps into TemporaryBuffer, so the getter result does land in the temp.
  • But when MostRecentPropertyAddress is non-null, it returns *MostRecentPropertyAddress (the raw field) and discards the getter result.

Read in code but not tested: multicast delegate out-params (ScriptCore.cpp:3400-3408) also step with nullptr and copy the raw value.

A/B results

The test fixture is a UMVVMViewModelBase subclass with FieldNotify, Getter properties. Each getter returns a different value from its backing field:

  • int32: field 99, getter 120
  • float: field -33, getter 2
  • double: field -33, getter 2
  • int32 BlueprintReadWrite: field 10, getter 20

An editor automation test builds and compiles Blueprint function graphs that pass each property to native UFUNCTION sinks. FKismetBytecodeDisassembler checks the bytecode.

Path Shipped Cast fix Cast fix + StepCompiledInRef fix
int32 / float / double -> same-type by-value param getter getter getter
float -> double param (FloatToDouble) raw getter getter
double -> float param (DoubleToFloat) raw getter getter
The two casts read through a Target pin (EX_Context) raw getter getter
const int32& / const float& / const double& param raw raw getter
float -> const double& param (cast + ref) raw getter getter
UPARAM(ref) int32&: value read by native code raw (10) raw getter (20)
UPARAM(ref) int32&: native += 100, field after the call 110 (written to the field, skipping any Setter) 110 10 (write lost)
BlueprintGetter + BlueprintPure UFUNCTION (workaround), every path above getter getter getter

Workarounds

  • Without an engine change: expose the value to Blueprint through UPROPERTY(FieldNotify, Getter, BlueprintGetter=GetX) plus UFUNCTION(BlueprintPure) GetX() const. Keep Getter for C++, reflection and MVVM. Blueprint then calls the function, and any cast or ref applies to its return value. This closed every tested path on the shipped engine.
  • Making the property `double` avoids FloatToDouble only. DoubleToFloat into native float params and the by-ref path remain.

Suggested fix

The two fixes are independent and were validated separately. The cast fix can land on its own while the by-ref behaviour is decided.

  1. Cast opcodes (validated, no regression seen): step into a local of the source type and convert from it, in both directions (code below). Patching only execDoubleToFloatCast misses the common case: a float property feeding a real pin goes through FloatToDouble.
  2. By-ref params (prototyped, NOT ready): in StepCompiledInRef, return TemporaryBuffer when the most recent property HasGetter() and has a container. That fixes every const-ref read, but writes through a mutable UPARAM(ref) param are then lost (last row of the table). Possible direction, untested: in the compiler (KismetCompilerVMBackend EmitFunctionCall), copy getter-backed properties into a temp for const-ref inputs only, and keep the address for mutable refs. Open decision for the Blueprint VM owners: what a mutable ref to a property with a Getter/Setter should do (call the Setter after the call, or refuse the connection).
  3. Delegate path: check the multicast delegate out-param path (ScriptCore.cpp:3400-3408) for the same pattern.
DEFINE_FUNCTION(UObject::execDoubleToFloatCast)
{
	double SourceValue = 0.0;
	if (Stack.StepAndCheckMostRecentProperty(Stack.Object, &SourceValue))
	{
		*reinterpret_cast<float*>(RESULT_PARAM) = static_cast<float>(SourceValue);
	}
}
DEFINE_FUNCTION(UObject::execFloatToDoubleCast)
{
	float SourceValue = 0.f;
	if (Stack.StepAndCheckMostRecentProperty(Stack.Object, &SourceValue))
	{
		*reinterpret_cast<double*>(RESULT_PARAM) = static_cast<double>(SourceValue);
	}
}

Related

  • [Link Removed]: getter/setter stack corruption with weak object properties in Blueprints (fixed 5.1.1, CL 23847620, which added CopyCompleteValueToScriptVM_InContainer). It shows getters are a supported Blueprint path, but it does not cover casts or by-ref params.
  • [Link Removed]: execInstanceVariable fails to copy MostRecentPropertyContainer (Cannot Reproduce). Same family: getters losing context on VM paths.
  • [Link Removed] (CL 18854053) and [Link Removed] (CL 20560449): origin of the current cast code.

Found through EPS case SF 27863750 (UE 5.9 / UE5-Main).

Steps to Reproduce
  1. In a C++ class (any UObject; a UMVVMViewModelBase subclass matches the report), declare UPROPERTY(BlueprintReadOnly, FieldNotify, Getter) float FloatProp = -33.f; with float GetFloatProp() const { return 2.f; }

    , and the same for double DoubleProp (getter returns 2) and int32 IntProp = 99 (getter returns 120).

  2. Add native BlueprintCallable sinks that log their value: RecordDouble(double V), RecordFloat(float V), RecordFloatRef(const float& V), RecordInt(int32 V).
  3. In a Blueprint subclass, wire Get FloatProp -> RecordDouble, Get DoubleProp -> RecordFloat, Get FloatProp -> RecordFloatRef, Get IntProp -> RecordInt, and call them.

Expected: every sink receives the getter value: 2, 2, 2, 120.

Actual: RecordDouble gets -33 (FloatToDouble), RecordFloat gets -33 (DoubleToFloat), RecordFloatRef gets -33 (const-ref), RecordInt gets 120.

Reproduced in the editor (Development, Win64) on //UE5/Main 5.9.0 CL 61286245, 100%. An automated harness (editor automation test, EPS.GetterCast.*) is available on request.

Have Comments or More Details?

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

0
Login to Vote

Unresolved
ComponentUE - Framework - Blueprint Runtime
Affects Versions5.9
CreatedDec 3, 2026
UpdatedDec 4, 2026
View Jira Issue