Hello guys!
I am doing this project where I need collisions which triggers text to show up. I kinda made collisions working with Debug.Log, but I have some problems with GUI Text. I tried everything, searched this forum, looked like 12 youtube videos about it - it just not showing up in Game view (it shouldn’t be visible in editor anyway).
Some screenshots how it looks like. It seems that GUI Text is in place, and I have GUI Layer in my camera - still nothing.
I am using Unity 5.3.4 personal edition.
Hope somebody could help me out, thanks a bunch guys.
Cheers!
Ok, I figured out something - GUI Text should’t be in Canvas. Now it works!
Other thing - how to assign specific GUI Text object to access from the collider object?
Now I have this, so GUIText should be added into the same object with collider…weird. I have tried that - it overrides the GUI text value, but still don’t show the actual text in the Game view. How to change the value of a specific Game Object then?
Cheers!
#pragma strict
private var guiShow : boolean = false;
var Text : GUIText;
function OnTriggerStay (other : Collider)
{
GetComponent.<GUIText>().text = "Hello world";
}
function OnTriggerExit (other : Collider)
{
if(other.tag == "other")
{
guiShow = false;
}
}