Download

Setting enum variables in the animation blueprint

I have C++ code to set a boolean variable in the animation blueprint. But I would like to do this to an enum variable.
For the boolean I do this:

UAnimInstance* ani = GetMesh()->GetAnimInstance();
UBoolProperty*pr= FindField<UBoolProperty> (ani->GetClass(), TEXT(“Docked”));
if ( pr ) pr->SetPropertyValue_InContainer (ani, IsDocked_);

For the enum variable, I can find it, cast it to UByteProperty and see its UEnum* :

UNumericProperty* en= FindField<UNumericProperty> (ani->GetClass(), TEXT(“AnimState”));
if ( en->IsEnum() && (enb= Cast<UByteProperty> (en)) != nullptr ) {
UEnum* enm = enb->GetIntPropertyEnum();

but I’m none the wiser about how I can change its value.