This is my code. The transformScale is supposed to make the “pause” sprite disappear or appear. The time thing is used to pause the game, of course. But it’s not working. Anything. The game doesn’t stop when I press P, the “pause” sprite is not appearing or disappearing. This script is attached to the “pause” sprite game object. Thank you for the help, as I’m REALLY REALLY new at this and a self learner ![]()
using UnityEngine;
using System.Collections;
public class Pause : MonoBehaviour {
bool paused;
void Start () {
transform.localScale = new Vector3(0, 1, 1);
paused = false;
}
void Update () {
if(Input.GetKeyDown("P") && paused == false)
{
Time.timeScale = 0.0f;
paused = true;
transform.localScale = new Vector3(1, 1, 1);
}
else if(Input.GetKeyDown("P") && paused == true)
{
Time.timeScale = 1.0f;
paused = false;
transform.localScale = new Vector3(0, 1, 1);
}
}