I have the following code attached to my main camera:
using UnityEngine;
using System.Collections;
public class DrawGui : MonoBehaviour {
public Texture crosshair;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void onGUI(){
//draw crosshairs
//GUI.DrawTexture(new Rect((Screen.width/2) - 3, (Screen.height/2) - 3, (Screen.width/2) + 3, (Screen.height/2) + 3),crosshair);
GUI.DrawTexture (new Rect(10,10,60,60), crosshair, ScaleMode.ScaleToFit);
}
}
The image I’m trying to use for the GUI is just a small red square (as a .png file) and is inserted into the crosshair variable in the inspector.
The problem: It’s not showing up! I can’t seem to get the red square to appear on the screen at all. I’ve tried changing the values in the rect and everything. Anyone know what’s up?