Can some one give me a script for a trigged pause menu with a resume button. So my car drives throught the collider, it pauses, and then to resume i have to click the resume button?
How about this?
// Set this up in the inspector
public Collider car;
bool paused = false;
void OnTriggerEnter(Collider other)
{
if(other == car)
{
paused = true;
Time.timeScale = 0;
}
}
void OnGUI
{
if(paused)
{
GUILayout.FlexibleSpace();
GUILayout.BeginVertical();
GUILayout.FlexibleSpace();
if(GUILayout.Button("Unpause")
{
Time.timeScale = 1;
paused = false;
}
GUILayout.FlexibleSpace();
GUILayout.EndVertical();
GUILayout.FlexibleSpace();
}
}