animation.isplaying hmm

Hey guys i’m just running through the end animation of my game and have noticed a problem, I need the ShowImage function to run when the animation finishes however it is not working when i add in !, if i remove this it will show when running which proves the function and the statement work just them seems to not like the !, is there a isnotplaying function?

if(Input.GetKeyUp(KeyCode.E) (mirror.gameObject.tag == "Stool"))
			{		
			Body.renderer.enabled = false; // hide body to avoid clipping
			MainCamera.camera.enabled = false;
			NooseCamera.camera.enabled = true;;
			foreach (MouseLook mLook in mLooks) // for each script called mlook
			{
			// disabels mouselook
			mLook.enabled = false;
			}	

			GameObject.FindWithTag("NooseCamera").animation.Play("camera");	
			
			if(!GameObject.FindWithTag("NooseCamera").animation.IsPlaying("camera"))
			{
			Debug.Log("Animation is not playing");
			ShowImage();
			}

Try this

 if(GameObject.FindWithTag("NooseCamera").animation.IsPlaying("camera")) {
          // do nothing
} else
            {

            Debug.Log("Animation is not playing");

            ShowImage();

            }

This should do the job.

Thanks for the reply I did try that previous and it doesn’t enter the else statement

I also tried

if(GameObject.FindWithTag(“NooseCamera”).animation.IsPlaying(“camera”))
{
// do nothing
}
else if(!GameObject.FindWithTag(“NooseCamera”).animation.IsPlaying(“camera”))
{
Debug.Log(“Animation is not playing”);
ShowImage();
}

Anyone?

Sorry to bump this again

Move it out of the Input block
It will only do the stuff on the frame during which you keyup

Wouldn’t it trigger the whole thing as its detecting e has been pressed and is now in the up state?