BCE0017 error with GUI scripts

I’ve been editing my GUI scripts because the images for my vitals where not shrinking when my health/stamina was depleting. I changed the script back to what it was, but now I have this error I did not have before:

“Assets/Scripts/GUI/GUI_HUD.js(38,39): BCE0017: The best overload for the method ‘GUI_CustomControls.LeftStatusMeter(UnityEngine.Texture, Object, UnityEngine.Texture, Object, UnityEngine.Texture)’ is not compatible with the argument list ‘(UnityEngine.Texture2D, float, float, UnityEngine.Texture2D, UnityEngine.Texture2D)’.”

What is causing this? Also, is this (or something else) causing my GUI textures not to shrink/fill up when I lose/gain health/stamina?

GUI_CustomControls:

//GUI_CustomControls: Contains the custom compunt control classes for use elsewhere in the GUI_CustomControls

//Item HUD Button------------------------------------------------
//Displays the button, button, correct overlay item picture, and the number of the item currently in Moalia's Invo.
function InvoHudButton(screenPos: Rect, numAvailable : int, itemImage: Texture, itemtooltip: String) : boolean 
{
	if(GUI.Button(screenPos, GUIContent(itemImage, itemtooltip), "HUD Button"))
		return true;
	GUI.Label(Rect(screenPos.xMax - 20, screenPos.yMax - 25, 20, 20), numAvailable.ToString());
	
	//Display area for tooltips
	GUI.Label(Rect(20, Screen.height - 130, 500, 100), GUI.tooltip);
}
//Left hand health------------------------------------
function LeftStatusMeter(charImage : Texture, health, hBarImage : Texture, stamina, sBarImage : Texture)
{
	GUI.BeginGroup(Rect(0,0, 330, 125));
	
	//Place front bars
	GUI.BeginGroup(Rect(120, 20, 218 * (health/100.0) + 10, 90));
	GUI.Label(Rect(0, 0, 272, 90), hBarImage);
	GUI.EndGroup();
	GUI.BeginGroup(Rect(120, 0, 218 * (stamina/100.0) + 10, 90));
	GUI.Label(Rect(0, 0, 272, 90), sBarImage);
	GUI.EndGroup();
	
	//Place body circle
	GUI.Label(Rect(0, 0, 330, 125), charImage);
	GUI.EndGroup();
}
@script AddComponentMenu("GUI/CustomControls")

GUI_HUD:

//GUI_HUD: DIsplays the pertinent information for Moalia

//Set up textures----------------------------------------
//For larger games, this should be done programmatically
var skin : GUISkin;
var staminaInjectorImage : Texture2D;

//Left vital tex
var lbarImage : Texture2D;
var lhbar : Texture2D;
var lsbar : Texture2D;
var MoaliaImage : Texture2D;

//---------------------------------------------------------
private var customControls : GUI_CustomControls;
private var playerInfo : Moalia_Status;
private var playerInvo : Moalia_Inventory;
private var playerAttack : Moalia_AttackController;
private var player;

//Initialize player info--------------------------------
function Awake()
{
	playerInfo = FindObjectOfType(Moalia_Status);
	customControls = FindObjectOfType(GUI_CustomControls);
	playerInvo = FindObjectOfType(Moalia_Inventory);
	playerAttack = FindObjectOfType(Moalia_AttackController);
	player = GameObject.FindWithTag("Player");
}

//Display------------------------------------------
function OnGUI()
{
	if(skin)
		GUI.skin = skin;
	
	//Moalia's vitals
	customControls.LeftStatusMeter(MoaliaImage, playerInfo.health, playerInfo.stamina, lhbar, lsbar);

	//Non-usable inventory buttons--------------------------
	customControls.InvoHudButton(Rect(Screen.width - 210, Screen.height - 100, 93, 95), playerInvo.GetItemCount(InventoryItem.STAMINA_INJECTOR), staminaInjectorImage, "Avalable Stamina Injectors in inventory.");
}
@script ExecuteInEditMode()
@script AddComponentMenu("GUI/HUD")

you didn’t specify the type for health

The error message literally explains the entire problem to you. In GUICustomControls you’ve defined a function called LeftStatusMeter, and said that it requires the following parameters:

  • charImage : Texture,
  • health, (which you haven’t specified a type for, so is just a generic “object”)
  • hBarImage : Texture,
  • stamina, (which you haven’t specified a type for, so is just a generic “object”)
  • sBarImage : Texture

Then in line 38 of GUIHUD you’re trying to call that function, but are passing it the following parameters:

  • MoaliaImage, (Texture2D)
  • playerInfo.health, (float)
  • playerInfo.stamina, (float)
  • lhbar (Texture2D)
  • lsbar (Texture2D)

Make sure all the parameters in the function definition are declared with an appropriate type, and then call the function with the right parameters corresponding to those types.