Top-Down Movement Animation - Idle Animation Based On Last Direction Moved?

I have a 4 way, top-down movement system set up so the player can go up, down, left, or right. I also have an animator blend tree set up so when you walk in a direction, the animation for walking in that direction will play. (I am using 2D sprites and spritesheets) Right now, when the player stops moving, the animator goes back to a single idle animation where the character is facing down. I have drawn an idle animation for each direction, but I don’t know how to implement them so that when you stop moving, the idle animation for the direction you last moved plays. (If you move left, then stop moving, the character should still be facing left.) I’m still a bit new to c# and unity and I don’t know how I would implement this with code or the blend tree I already have.

My movement script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
    public float moveSpeed = 5f;
    public Rigidbody2D rb;
    public Animator animator;

    Vector2 movement;

    // Update is called once per frame
    private void Update()
        movement.x = Input.GetAxisRaw("Horizontal");
        movement.y = Input.GetAxisRaw("Vertical");

        animator.SetFloat("horizontal", movement.x);
        animator.SetFloat("vertical", movement.y);

    private void FixedUpdate()
        rb.MovePosition(rb.position + movement * moveSpeed * Time.fixedDeltaTime); 


Any help is appreciated!

I found a youtube vid from Unity that has the system I’m looking for. I downloaded the project and basically took the IsometricPlayerMovementController and IsometricCharacterRenderer scripts and threw them in my project and it worked. Creating 2D Player Movement for Isometric Games with Unity 2018.3! (Tutorial) - YouTube Hope this helps anyone else trying to do this.