Why my animation randomly doesn't work

So I have some code in the first file:

public Animator anim;

void Update () {
            if (Input.GetButtonUp("Jump"))
            {
                Debug.Log("Space Recorded");
                StartCoroutine(Fading());
            }
        
        }
    
        IEnumerator Fading()
        {
            Debug.Log("Coroutine started");
            anim.SetBool("Fade", true);
            Debug.Log("Animation Activated");
            yield return new WaitUntil(() => black.color.a == 1);
            moveCamera = true;
            Debug.Log("Moving camera");
    
        }

and this in a second file:

void Update () {
        if (Door.moveCamera == true)
        {
            Debug.Log("Camera is being moved");
            transform.position = new Vector3(0.58f, 0.45f, -5.7f);
            Door.moveCamera = false;
        }
    }

When I press Space, an animation is played, and the camera moved to a new position. However, sometimes, when I press Space without doing anything else, the code tells me that Space was pressed, it changes the animator boolean which should start the animation, but then it just waits for the animation to complete. The animation however doesn’t start at all. Sometimes it works, sometimes it doesn’t. Also, if I press any other button before Space, the same problem occurs.

@fiveSpotGames Try changing the transition time to “none”, or make it really short. Sometimes all or most of the animation won’t happen because it’s transitioning during the time it would play. I would recommend looking into interruption sources as well.