Ok right now im working on a simple inventory system. I tryed using a game object attached to the script but that didnt work, so im trying to just make a new GUITexture in a script but now the damn thing wont show up. Heres what i got.
public class InventoryBag : MonoBehaviour
{
public Texture BagText;
private GUITexture BagFrame;
public bool ShowIn;
// Use this for initialization
void Start ()
{
BagFrame = new GUITexture();
BagFrame.transform.position = Vector3.zero;
BagFrame.transform.localScale = Vector3.zero;
BagFrame.pixelInset = new Rect(300f, -228f, 164f, 205f);
BagFrame.texture = BagText;
}
// Update is called once per frame
void Update ()
{
if(Input.GetButton("ShowInv"))
{
if(BagFrame.enabled = false)
{
BagFrame.enabled = true;
}
if(BagFrame.enabled = true)
{
BagFrame.enabled = false;
}
}
}
}
I get a NullReferenceException.