Toggle GUITexture V.2

Yo! Unity Answers, ( first time here)
so i need help with this Toggle Texture thing.

i have this Texture in my Scene which is the Inventory GuiTexture show in Picture1.

i can toggle it on and off no problem, but the problem is
whenever i start my game the Inventory GuiTexture is on ToggleOn mode.

what i need is that the Inventory GuiTexture is on ToggleOff Mode when i start my game, show in Picture2

here’s the script of Inventory GuiTexture

function Update() {

 if (Input.GetKeyDown(KeyCode.F1)) {

    guiTexture.enabled = !guiTexture.enabled;



–thanks to Kith for the script

Add this to the Start function of your script:

guiTexture.enabled = false;

It will set the value of guiTexture.enabled to false when your script is enabled.

If you don't have a Start function, you can create one by adding this to your script:

function Start ()
    guiTexture.enabled = false;

The code inside the Start function gets called one time when your script gets enabled.




The code you already have executes every frame because it’s in a function named Update. Every frame it checks whether or not the F1 key is pressed.

If F1 was pressed during the current frame, it executes the code in the if block, which toggles the value of the enabled property of the guiText attached to the GameObject with your script.