Hey guys, using C# to make an ingame Menu which’ll toggle on and off.
Using the blur screen Image effect for once I hit escape and too disable once Escape is pressed again.
here is my script;
using UnityEngine;
using System.Collections;
public class IngameMenu : MonoBehaviour
{
bool paused = false;
void Update()
{
if (Input.GetKeyDown(KeyCode.Escape))
togglePause();
}
void OnGUI()
{
//boop
}
void togglePause()
{
if (paused)
{
Time.timeScale = 1f;
paused = false;
}
else
{
Time.timeScale = 0f;
paused = true;
}
}
}
I was wondering if it were possible to actually disable/enable to script or communicate to it via the code, I’m not too sure how to do it.