using UnityEngine; using System.Collections; using UnityEngine.UI; public enum ShowMessageType { prompt, error, warning } public class MessageTool : MonoBehaviour { // Use this for initialization public GameObject messagePrefab; void Start() { } void Update() { } public GameObject showMessage(ShowMessageType type, string title, string details) { GameObject item = Instantiate(messagePrefab) as GameObject; item.transform.parent = transform; item.GetComponent().anchoredPosition = new Vector2(0, 0); var message = item.GetComponent(); message.title.text = title; message.details.text = details; message.Type = type; return item; } }