I would not want to have to create another Scene again to show the information ... I would like to show it on the same screen and without leaving it stuck. Could someone help me?
I would not want to have to create another Scene again to show the information ... I would like to show it on the same screen and without leaving it stuck. Could someone help me?
Follow a small script in C # to create an object that is a message box:
using UnityEngine;
using System.Collections;
public class MessageBox : MonoBehaviour
{
//A janela 200x300 px aparecerá no centro da tela.
private Rect windowRect = new Rect ((Screen.width - 200)/2, (Screen.height - 300)/2, 200, 300);
//Variavel para controlar a visibilidade.
private bool show = false;
void OnGUI ()
{
if(show)
windowRect = GUI.Window (0, windowRect, DialogWindow, "Turma de 2009");
}
//Este é o metodo que cria a janela
void DialogWindow (int windowID)
{
float y = 20;
//Insere um label com o texto desejado
GUI.Label(new Rect(5,y, windowRect.width, 20), "Texto desejado");
//Texto para fechar a janela
if(GUI.Button(new Rect(5,y, windowRect.width - 10, 20), "Fechar"))
show = false;
}
//Para abrir o diálogo de você chama este método no botão que você criou na tela
public void Open()
{
show = true;
}
}
I could not perform the tests here because I am without Unity installed