Unity3D on trigger enter display Text. Tutorial 11
This is Better New Video it's more detailed.
THIS IS Java scrip: GOOD 4 2D GAMES AND 3D GAMES !
--------------------------------------------------------------------------------------
var player : GameObject;
private var bool : boolean;
function OnTriggerEnter(other : Collider) {
if(other.tag == "Player") {
bool = true;
}
}
function OnGUI(){
if(bool == true) {
if(GUI.Button (Rect (500, 300, 500, 80), "You can move by pressing the W,A,S,D Keys\nPress Space Bar to Jump, (E) Key is Action!\n\n[Click to close]")) {
bool = false;
Destroy(gameObject);
}
}
}
---------------------------------------------------------------------------------
AND THIS VERSION OFF JAVA SCRIPT WILL NOT DESTROJ BOX OBJECT
ON TRIGGER ENTER :
--------------------------------------------------------------------------------------------------
#pragma strict
function Start () {
}
function Update () {
} var player : GameObject;
private var bool : boolean;
function OnTriggerEnter(other : Collider) {
if(other.tag == "Player") {
bool = true;
}
}
function OnGUI(){
if(bool == true) {
if(GUI.Button (Rect (500, 300, 500, 80), "Message goes here Click to close")) {
Debug.Log("Door Works!");
bool = false;
}
}
}
0 comments:
Post a Comment