A warning box will appear when user made a mistake. A prefab of a UI will be created and user will click on the button to close it after reading.
First a script is attached to the prefab canvas
Secondly the button is being setup to activate the function when user clicks
Ensure the GUI is being updated to the prefab
The CloseDialog script using Object.Destroy which contains the following codes
using UnityEngine; using System.Collections; public class closeDialog : MonoBehaviour { public void DestroyThis() { Object.Destroy (this.gameObject); //Debug.Log ("Closing this now"); } }