I’ve found a script for activating GUI on collision (1).
Here’s the script :
using UnityEngine;
using System.Collections;
public class messagebox : MonoBehaviour {
public Transform other;
void OnGUI() {
if (other) {
float dist = Vector3.Distance(other.position, transform.position);
if(dist < 10 ){GUI.Box (new Rect(0,0,100,100),"Well done!!");
}
}
}
}
But after second collision (bouncing ball) the GUI disappears.
How I can make the GUI ‘lock’? I should use another type of GUI (I mean, not GUI.Box or something different)? I’m trying to change bits of the text, but nothing works.
Or maybe I should use GUI.Enabled?