Cant find animation target

I have an invisible collider that when the player walks through, it activates a UI animation. The problem is, if i ever take my eyes off the animation tab (to look at the code or something), suddenly it cant find the gameobject, and the animation dosent work and when I click on the object in the hierarchy, it can find it again. The only change in the object is its color alpha. I’ve checked the code, everything runs exactly as shown.

I deleted all animators and animations and everything related, and put them back in. That worked for some reason.