I’m attempting to create a viewmodel that has a TMap property using the 5.1 version of the UMG Viewmodel plugin.
.h file
UPROPERTY(BlueprintReadWrite, FieldNotify, Setter)
TMap<FName, float> MyParams;
void SetMyParams(TMap<FName, float> NewValue);
.cpp file
void UZRUIAbilityViewModel::SetMyParams(TMap<FName, float> NewValue)
{
UE_MVVM_SET_PROPERTY_VALUE(MyParams, NewValue);
}
The macro uses the following template function in MVVMViewModelBase.h which is where I get the compile error listed below:
template<typename T, typename U>
bool SetPropertyValue(T& Value, const U& NewValue, UE::FieldNotification::FFieldId FieldId)
{
if (Value == NewValue)
{
return false;
}
Value = NewValue;
BroadcastFieldValueChanged(FieldId);
return true;
}
MVVMViewModelBase.h(84): [C2678] binary '==': no operator found which takes a left-hand operand of type 'T' (or there is no acceptable conversion)
Does the UE_MVVM_SET_PROPERTY_VALUE
macro not support TMap types? Is there a fix for this issue?