Ok so anyway I am trying to create a script where when the player enters an area a gui pops up and he takes damage like a radiation zone to stop him from going out of the map. Heres my script don’t really know what’s wrong with it. and by the way the character is a cube and the area i am entering is also a cube just without the mesh render with is trigger selected under box collider!
var showgui : boolean = false;
public var myskin : GUISkin;
function OnCollisionEnter (col : Collision) {
if(col.gameObject.Tag == "Player"){
PlayerStats.curHp -= 100;
showgui = true;
}
}
function OnGUI ()
{
GUI.skin = myskin;
if (showgui)
{
GUILayout.Box("WARNING ENTERING RADIATION ZONE");
}
}