Hey there!
I’ve ran into a problem whilst creating a slide in and slide out animation for a panel in the UI. Basically, I’m trying to get the panel to slide in when the “E” key is pressed and to slide out when it is pressed again. I’ve set up the animator with one bool named “isOpen”.
bool isOpen = false;
public Animator phoneAnimator;
public void Update()
{
if (Input.GetKeyDown("e") && !isOpen)
{
phoneAnimator.SetBool("IsOpen", true);
isOpen = true;
}
if (Input.GetKeyDown("e") && isOpen)
{
phoneAnimator.SetBool("IsOpen", false);
isOpen = false;
}
}
I can upload the animators transitions if that would help too!
Thanks in advance!