GUI script help!

Hi!
So I have this script here

var aTexture : Texture;

function OnTriggerEnter()

{

  guiMode = "showboard";

}

function OnTriggerExit()

{

  guiMode = "noboard";

}

function OnGUI()

{  
  if(guiMode == "showboard")

  {

    GUI.DrawTexture(Rect(Screen.width/2-500,-20,1000,600), aTexture);

  }
}

**What it is supposed to do is, when the player enters a trigger box a picture is shown on screen. Then, when the player leaves the picture is no longer shown. I keep getting two errors, one says “unknown identifier: “guiMode””, and the other says, “object reference is not set to an instance of an object”. I can’t figure out what’s wrong! Thanks for the help!

-Rov**

This is untested so it might have an error but try this.

    var mytextue : Texture;
    var show : boolean = false;
    
    function OnTriggerEnter ()
    {
    show = true;
    }
    
    function OnTriggerExit ()
    {
    show = false;
    }
    
    function OnGUI ()
    {
if (show)
    GUI.DrawTexture(Rect(Screen.width/2-500,-20,1000,600), mytexture);
    }

You must declare the variable as String.

var aTexture : Texture;
var guiMode : String;

function OnTriggerEnter()
{
  guiMode = "showboard";
}

function OnTriggerExit()
{
  guiMode = "noboard";
}

function OnGUI()
{  
  if(guiMode == "showboard")
  {
     GUI.DrawTexture(Rect(Screen.width/2-500,-20,1000,600), aTexture);
  }
}