I want to make it so if my panel is active then Time.timescale = 0, paused. I made a code but every time i try it the game just wont stay paused and my play button dissapears but the panel stays.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Play : MonoBehaviour
{
public GameObject Panel;
void Paused ()
{
Panel.SetActive(true);
Time.timeScale = 0;
}
public void Start()
{
Panel.SetActive(false);
Time.timeScale = 1;
}
}