Hi,
Im not sure what I am doing wrong, as the code works on a 3d object. I have tryed applying it to a UI image that is set in screen space, but it isnt picking up being clicked on can anyone help me with why it isnt working.
using UnityEngine;
using System.Collections;
public class ExitScript : MonoBehaviour {
[SerializeField]
DisplayBoxInitializer boxInitializer;
[SerializeField]
GameObject Exit ;
public CharacterMotor charactermotor;
public Player player;
public MouseLook mouselook;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnMouseDown (){
{
charactermotor.enabled = true;
mouselook.enabled = true;
//player.enabled = true;
Screen.lockCursor = true;
GetComponent<Renderer>().material.color = Color.red;
StartCoroutine ("wait");
//Exit.enabled = false;
}
}
IEnumerator wait(){
yield return new WaitForSeconds (0.5f);
player.enabled = true;
}
}