Hello everybody. I got this script from the forums and I want it to be activated when I click on the character. But this activates when I push a key like s. Can somebody tell me how to change this.
var MyText : String = String.Empty;
var ScreenArea : Rect;
//var TextArea : Rect;
//var MyFont : GUIStyle;
//var DialogueBG : Texture2D;
private var DisplayThis : boolean = false;
function Update()
{
if (Input.GetKeyDown(""))
DisplayThis = !DisplayThis;
}
function OnGUI()
{
if (DisplayThis)
GUI.Box(ScreenArea, MyText);
/*
//alternatively...
if (displayThis)
{
GUI.Label(ScreenArea, DialogueBG);
GUI.Label(TextArea, MyText);
}
*/
}
var MyText : String = String.Empty;
var ScreenArea : Rect;
//var TextArea : Rect;
//var MyFont : GUIStyle;
//var DialogueBG : Texture2D;
private var DisplayThis : boolean = false;
function Start()
{
MyText = "Hello world! How are you doing?";
ScreenArea = Rect (10, 10, 200, 100);
}
[COLOR="#006400"]//commented out[/COLOR]
function Update()
{
[COLOR="green"] //if (Input.GetKeyDown(""))
// DisplayThis = !DisplayThis;[/COLOR]
}
[COLOR="green"]//Click and release the left button of a mouse[/COLOR]
function OnMouseUp()
{
DisplayThis = !DisplayThis;
}
function OnGUI()
{
if (DisplayThis)
GUI.Box(ScreenArea, MyText);
}