Setting Animation Rigging Constraint values at edit time, lost when starting play mode


These values are set by the following script at edit time:
image

But as soon as I hit play, the values on the constraint are lost.

How can I retain them?

Manually marked the target constraint components as dirty after setting their data, it solved the issue.

constraint = GetComponentInParent<TwoBoneIKConstraint>();

Undo.RecordObject(constraint, "Helper - constraint");

constraint.data.root = animator.GetBoneTransform(rootBone);
constraint.data.mid = animator.GetBoneTransform(midBone);
constraint.data.tip = animator.GetBoneTransform(tipBone);

constraint.data.target = targetTransforms.Get(targetTransform);
constraint.data.hint = targetTransforms.Get(hintTransform);

EditorUtility.SetDirty(constraint);