Hi
I have a simple script which only has an OnGUI function in it. However this OnGUI function has 17 different lines (all labels) in it, all of which throw up the same variable, error CS0426: The nested type Label' does not exist in the type
UnityEngine.GUI’.
Here is my code
using UnityEngine;
using System.Collections;
public class LeagueGUI : MonoBehaviour {
GUIStyle LeagueGUIStyle1;
void OnGUI ()
{
new GUI.Label (new Rect (0,0,100,50), "Races Left : " + League.RacesLeft, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Points : " + League.Points, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Points for 1st :" + League.PointsForWin, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Points for promotion :" + League.PointsForPrize, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Points for staying :" + League.PointsForOut, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Money for winning:" + League.MoneyForWin, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Money for promotion" + League.MoneyForPrize, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Money for staying" + League.MoneyForOut, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Money for Relegation" + League.MoneyForRelegation, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Fame for 1st" + League.FameForWin, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Fame for Promotion" + League.FameForPrize, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Fame for staying" + League.FameForOut, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "FameForRelegation" + League.FameForRelegation, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Races Left" + League.PrizeForWin, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Races Left" + League.PrizeForPrize, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Races Left" + League.PrizeForOut, LeagueGUIStyle1);
new GUI.Label (new Rect (0,0,100,50), "Races Left" + League.PrizeForRelegation, LeagueGUIStyle1);
}
// Use this for initialization
void Start () {
League League = GameObject.Find("Main_Camera").GetComponent<League>();
}
// Update is called once per frame
void Update () {
}
}
I have looked this question up on unity answers but all of the answers seem to be that the people didnt have void OnGUI () in their script.
Im really stuck and have no idea what the problem is.
Thanks in advance for your help