GUIStyle returning error (error inside)

Hey, I am having a little problem with one of my scripts. I have used this countless times throughout my game but for this specific script, apparently it’s not right. Hopefully you guys can point me in the right direction :slight_smile:

Basically, the error message is this:

Assets/Scripts/Movement.js(36,18): BCE0023: No appropriate version of ‘UnityEngine.GUI.Label’ for the argument list ‘(UnityEngine.Rect, String, System.Type)’ was found.

I want to include the GUIstyle within my inspector tab but all it does is return the above error. Here is my code:

var speed : float = 3.0;
var rotateSpeed : float = 3.0;
var bulletPrefab:Transform;
var shotDelay = 2;
var status1 = "Loaded";
var style = GUIStyle;


function Start () {
    while (true) {
        while (!Input.GetButtonDown("Jump")) yield;
		bullet = Instantiate(bulletPrefab, GameObject.Find("SpawnPoint").transform.position, transform.rotation);
			bullet.tag = "bulletShot";
			status1 = "Reloading";
			bullet.rigidbody.AddForce(transform.forward * 5000);
        yield WaitForSeconds(shotDelay);
        status1 = "Loaded";
    }
}

function Update ()
{
	var controller : CharacterController = GetComponent(CharacterController);
	transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
	var forward : Vector3 = transform.TransformDirection(Vector3.forward); var curSpeed : float = speed * Input.GetAxis ("Vertical");
	controller.SimpleMove(forward * curSpeed);
	

	}
@script RequireComponent(CharacterController)


function OnGUI()
{
		
    	GUI.Label(Rect(951, 40, 100, 20), status1, style);
}  

The important bit is within the OnGUI function and for some reason it is returning this error, can anyone see the problem?

Additional information: Script name - Movement.js

Thanks in advance guys, this has been puzzling me for a while :stuck_out_tongue:

In UnityScript this line:

var style = GUIStyle;

Will store the System.Type of the GUIStyle class in your style variable.

I guess you want something like this:

var style : GUIStyle;

So your variable type is GUIStyle. But GUIStyles usually can’t really be assigned in the inspector, so usually you would use a string with the style name and / or use a custom GUISkin.