Hi, I've been having some trouble creating a GUI Message Box.
Basically, I want to make a script for the message box, but be able to call this message box from a different script.
I would use this on a different script:
MessageBox("Text goes here.");
or something like that but it would be getting the message box from the original script.
you vould put on this script if you want only words but can convert it into a button easily if you want:
//the name of this script this following code is in is important! will be
//refered to as "Message" by me. so you could replace Message in the next code with your actual name for it.
static var Str : String;
and that would automaticlly make the string ubneditable through the inspector (making it 100% program-changable and programming-changable only!) but it displays the text as a preset label.
in another script you could do
if(Input.GetKeyDown(KeyCode.delete)) // when the delete key is pressed
Message.Str = "Deleted"; // example word to be displayed.
i hope that helps you, and that if this isn't what you wanted, that it at least helps you understand what you could do to optimize it to your situation!
For anyone looking for something similar, i made a simple message box, easy to use, feel free to try it:
Simple-Message-Box-Unity on Github