Conflict between two scripts

Hi everybody,
I would now where is my mistake in my scripts.
The first script is a toggle,which allow the slideup or slidedown of menu settings,but when I play level and I get out of it with my pause menu the sliding panel doesn’t work.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class UI : MonoBehaviour {
    public Animator contentPanel;
    public Animator gearImage;


    public void ToggleMenu()
    {
        contentPanel.enabled = true;
        bool isHidden = contentPanel.GetBool("isHidden");
        contentPanel.SetBool("isHidden", !isHidden);
        gearImage.enabled = true;
        gearImage.SetBool("isHidden", !isHidden);
    }
    // Use this for initialization

    void Start()
    {
        RectTransform transform = contentPanel.gameObject.transform as RectTransform;       
        Vector2 position = transform.anchoredPosition;
        position.y -= transform.rect.height;
        transform.anchoredPosition = position;
    }
}

This is the toggle menu

using UnityEngine;
using System.Collections;

public class PauseMenuScript : MonoBehaviour {
   
    //refrence for the pause menu panel in the hierarchy
    public GameObject pauseMenuPanel;
    //animator reference
    private Animator anim;
    //variable for checking if the game is paused
    private bool isPaused = false;
    // Use this for initialization
    void Start () {
        //unpause the game on start
        Time.timeScale = 1;
        //get the animator component
        anim = pauseMenuPanel.GetComponent<Animator>();
        //disable it on start to stop it from playing the default animation
        anim.enabled = false;
    }
   
    // Update is called once per frame
    public void Update () {
        //pause the game on escape key press and when the game is not already paused
        if(Input.GetKeyUp(KeyCode.Escape) && !isPaused){
            PauseGame();
        }
        //unpause the game if its paused and the escape key is pressed
        else if(Input.GetKeyUp(KeyCode.Escape) && isPaused){
            UnpauseGame();
        }
    }
   
    //function to pause the game
    public void PauseGame(){
        //enable the animator component
        anim.enabled = true;
        //play the Slidein animation
        anim.Play("PauseIn");
        //set the isPaused flag to true to indicate that the game is paused
        isPaused = true;
        //freeze the timescale
        Time.timeScale = 0;
    }
    //function to unpause the game
    public void UnpauseGame(){
        //set the isPaused flag to false to indicate that the game is not paused
        isPaused = false;
        //play the SlideOut animation
        anim.Play("PauseOut");
        //set back the time scale to normal time scale
        Time.timeScale = 1;
    }
   
}

This is pause menu
Where is the problem?

You never call ToggleMenu() ?

I followed this tutorial
http://www.raywenderlich.com/79046/unity-new-gui-tutorial-part-3

you set timescale to 0 so the animations stop (an animation being a “change over time” which doesn’t work when time isn’t running…).

bit of googling came to this post: Animations ignore TimeScale - Questions & Answers - Unity Discussions (ignore the op and the “answer”, you’re after the newer post from rakkarage at the bottom)

reference page for that attribute:

1 Like

Thank You so much It works perfectly :)))