public static void ShowMessageBox(string text, GameObject canvas, MessagePromptDelegate callback) { GameObject newObject = Resources.Load("Prefabs/MessagePrompt") as GameObject; newObject = (GameObject)GameObject.Instantiate(newObject); newObject.GetComponent <MessagePrompt>().Text.text = text; newObject.GetComponent <MessagePrompt>().transform.SetParent(canvas.transform); newObject.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.width / 2, Screen.height / 2); newObject.transform.position = canvas.transform.position; newObject.transform.localScale = new Vector3(1, 1, 1); newObject.GetComponent <MessagePrompt>().SetCallback(callback); }
public void SetCallback(MessagePromptDelegate callback) { this.messagePromptCallback = callback; }