Change player's y-position for a specific animation

Hi everyone !

My player is a witch who has an “idle” animation and a “flying” animation.
However, the “flying” animation is fixed on the ground, I would like to move the witch a little bit up in the air (y = 0.2) but only when the “flying” animation is performing.

Here, my witch is infinitly moving up.

 void Animating (float h, float v)
    	{
    		bool flying = h != 0f || v != 0f;
    		
    		if (flying)
    		{
    			animation.CrossFade("fly", 0.2f);
    			transform.Translate(0, 0.2f, 0, Space.World);
    		}
    		else
    		{
    			animation.CrossFade("idle", 0.2f);
    		}
    
    	}

I found a similar subject, but the suggested solution doesn’t work for me :

How can I just have my witch in position (x, 0.2, z) only during this “flying” animation ?

Ok, find myself the solution on others pages of this website, sorry ^^

		bool flying = h != 0f || v != 0f;

		Vector3 temp = transform.position; 

		// Animate
		if (flying)
		{
			temp.y = 0.5f; 
			transform.position = temp; 
			animation.CrossFade("fly", 0.2f);
		}
		else
		{
			temp.y = 0f; 
			transform.position = temp; 
			animation.CrossFade("idle", 0.2f);
		}

		// Move the player to it's current position plus the movement.
		playerRigidbody.MovePosition (transform.position + movement);