Hiya
I am getting an object reference error on my code within the OnGUI method but I was wondering on what I need to do here.
I do want to load the textures on screen but without the error that keeps popping up.
using UnityEngine;
using System.Collections;
public class scriptTest : MonoBehaviour {
public Texture2D[] circles = new Texture2D[7];
public int level = 0;
public int counter = 0;
// Update is called once per frame
void Update () {
circleFilled();
}
void circleFilled(){
if(counter >= 1000){
counter = 0;
level++;
OnGUI();
}
if(level >= 6){
level = 6;
counter = 0;
}
}
void OnGUI(){
if(level == 0) GUI.DrawTexture(new Rect(20, 10, 15, 30), circles[0]);
else if(level == 1) GUI.DrawTexture(new Rect(20, 10, 15, 30), circles[1]);
else if(level == 2) GUI.DrawTexture(new Rect(40, 10, 15, 40), circles[2]);
else if(level == 3) GUI.DrawTexture(new Rect(60, 10, 15, 50), circles[3]);
else if(level == 4) GUI.DrawTexture(new Rect(80, 10, 15, 60), circles[4]);
else if(level == 5) GUI.DrawTexture(new Rect(100, 10, 15, 70), circles[5]);
else if(level == 6) GUI.DrawTexture(new Rect(120, 10, 15, 80), circles[6]);
/*
*/
}
}
Some tips are grateful.
Thanks