- Home /
 
               Question by 
               he110me · Jan 09, 2014 at 02:22 AM · 
                guitexturecrosshairdrawtexture  
              
 
              GUI.DrawTexture not working? (nothing shows up)
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?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by robertbu · Jan 09, 2014 at 02:23 AM
The language is case sensitive. The function name is 'OnGUI()' with an upper case 'o'.
Your answer
 
 
             Follow this Question
Related Questions
GUItexture change on mouseenter 3 Answers
Texture for cross hair is is messed up 1 Answer
Tiling textures issue 1 Answer
Crosshairs change when sprinting? 3 Answers
