Custom Editor wIndow not being detected by the Animation window

I’m moving a gameobject using my custom Editor Window with this code:

"
m_Transform.position = EditorGUILayout.Vector2Field("Position: ", m_Transform.position);
"

But when I press the Record button in the Animation window, the movement doesn’t get recorded or registered as a new keyframe.

Is there a way I can make my custom Editor Window get detected by the Animation window?

Use RecordObject before your change:

Undo.RecordObject(m_Transform, "Changed position");
m_Transform.position = EditorGUILayout.Vector2Field("Position: ", m_Transform.position);