- Home /
help with errors
Hello In one of my scripts I keep getting the errors BCE0023: No appropriate version of 'UnityEngine.GUI.Button' for the argument list '(UnityEngine.Rect, System.Type)' was found. and BCE0023: No appropriate version of 'UnityEngine.GUI.Label' for the argument list '(UnityEngine.Rect, String, System.Type)' was found. Here is my code
#pragma strict
var Friendly_Race = Texture;
var League = Texture;
var Tournament = Texture;
var One_on_One = Texture;
var Time_Lap = Texture;
var Stats = Texture;
var money_GUI_Style = GUIStyle;
var smaller_option_GUI_Style = GUIStyle;
var two_smaller_option_GUI_Style = GUIStyle;
var Career_GUI_Skin = GUISkin;
function Start () {
var career : Career_Variables = Career_Variables.GetComponent(Career_Variables);
}
function Update () {
}
function OnGUI()
{
GUI.Label(new Rect(605, 8, 20, 20), Career_Variables.money.ToString(), money_GUI_Style);
GUI.Label(new Rect(850, 100, 20, 20), Career_Variables.Races_Completed.ToString(), smaller_option_GUI_Style);
GUI.Label(new Rect(1155, 100, 20, 20), Career_Variables.Fame.ToString(), two_smaller_option_GUI_Style);
GUI.Label(new Rect(1319, 140, 20, 20), Career_Variables.Races_won.ToString(), two_smaller_option_GUI_Style);
if (GUI.Button(new Rect(5,170,400,220), Friendly_Race))
{
Application.LoadLevel ("Level Select");
}
if (GUI.Button (new Rect (5,390,400,220), League))
{
Application.LoadLevel ("BuySell_Cars");
}
if (GUI.Button (new Rect (425,390,400,220), Tournament))
{
Application.LoadLevel ("My Garage");
}
if (GUI.Button(new Rect(5,170,400,220), One_on_One))
{
Application.LoadLevel ("Level Select");
}
if (GUI.Button (new Rect (5,390,400,220), Time_Lap))
{
Application.LoadLevel ("BuySell_Cars");
}
if (GUI.Button (new Rect (425,390,400,220), Stats))
{
Application.LoadLevel ("My Garage");
}
}
The variables money, Races_Completed, Fame and Races_won are from my script Career_Variables. Im not sure if the errors are stemming from the GUI part of my script or some other part. Thank you in advance
Answer by matteonite · May 08, 2014 at 08:41 PM
I don't use javascript but isn't it
var League : Texture;
not an = sign?
I might be wrong.
Still in C# mode. Sorry I was just translating this from C# and that is the problem
Answer by ForeignGod · May 08, 2014 at 08:56 PM
Remove "new" from labels
works for me
Also, as matteonite said
Change your texture variables
from = Texture; to : Texture;
Your answer
Follow this Question
Related Questions
make key as a button 1 Answer
Move the text in a GUI Button/Box 1 Answer
How to make the tab key to show/hide GUIlayer 1 Answer
Setting Scroll View Width GUILayout 1 Answer
[Solved]The Right way of doing PopUp 1 Answer