I am new to Unity and am trying to create a pause menu. When the game object is active, the game does pause as I had wanted. However, the game is still paused when the game object is set to not active again. Here is the script which I have now:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PauseMenu : MonoBehaviour
{
void Update()
{
if (gameObject.activeSelf)
{
Time.timeScale = 0f;
}
else
{
Time.timeScale = 1f;
}
}
}