[C#] Initialize a variable for use within OnGUI?

Hello, I’m new to C# in Unity, and I can’t find anything that says anything about how to do this.
I want a Boolean variable called “showinv” that, when true, shows an inventory, but, when false, only shows a button, this is what I’ve coded;
using UnityEngine;
using System.Collections;
public class MenuGUI : MonoBehaviour {
// Use this for initialization
void Start () {
bool showinv = false;
}
void OnGUI () {
//GUI Menu Box
if (showinv){
GUI.Box(new Rect(10,10,100,200), “Menu”);
}
else{
GUI.Box(new Rect(10,10,100,60), “Menu”);
}
if (GUI.Button(new Rect(15,32,85,24), “Inventory”)) {
//Execute Menu Button Press.
Debug.Log(“Open Inventory”);
showinv=!showinv;
}

	}
}

But Unity shows errors no mater what I try (I’m guessing that OnGUI is initialized before Create?)
I have 3 errors like this; Assets/MenuGUI.cs(19,25): error CS0103: The name showinv' does not exist in the current context. And one warning; Assets/MenuGUI.cs(6,22): warning CS0219: The variable showinv’ is assigned but its value is never used.

Thanks in advance!

You need to declare showinv in a class scoped area. ie outside the start function.

bool showinv = false;

void start()
{
   showinv = false;
}

void OnGUI()
{
    if(showinv){
    //Do something
    }    
}

}