I have a bunch of prefabs instantiated, each with this script attached:
using UnityEngine;
using System.Collections;
public class NodeData : MonoBehaviour {
public int nodeIndex;
public string nodeName;
public int nodeNumIP;
public string nodeCountryCode;
public float nodeLatitude;
public float nodeLongitude;
private bool showData = false;
void OnMouseDown()
{
showData = true;
Debug.Log("True");
int waitSeconds = 5;
StartCoroutine(WaitSomeTime(waitSeconds));
showData = false;
Debug.Log("False");
}
IEnumerator WaitSomeTime(int waitTime)
{
yield return new WaitForSeconds(waitTime);
}
void OnGUI()
{
if(showData) {
Debug.Log("Clicked!");
GUI.Label (new Rect (10, 10, 100, 20), "Clicked!");
}
}
}
When I move the camera so one of the nodes is clearly visible, and then put the mouse pointer over the node and left click, none of the Debug.Log statements show up, nor does the GUI.Label.
I’m clearly missing something here but haven’t been able to figure out what. Help, please?
Thanks in advance!