Hi
In my game when the player falls of the edge and touches a trigger a gui buttom should appear however it doesn’t.
using UnityEngine;
using System.Collections;
public class GameOver : MonoBehaviour {
public GameOverScript GameOverVar;
public bool isClicked = false;
bool guiOn = false;
public float OnX = 15f;
public float OnY = 15f;
public float width = 100f;
public float height = 50f;
public string textInGUI = "Try again?";
void OnTriggerEnter2D (Collider2D over)
{
if(over.gameObject.tag == "Player")
{
GameOverVar.isGameOver = true;
if (GameOverVar.isGameOver == true)
{
//Application.LoadLevel(1);
guiOn = !guiOn;
}
}
}
void OnGUI()
{
if(guiOn)
{
GUI.Button(new Rect(OnX,OnY,width,height), textInGUI);
Debug.Log("It worked");
guiOn = false;
}
}
}
Also the Debug.Log(“It worked”); does output in the console