Transform variable not accepting any values.

My transform variable “barrelEnd” will not accept any values within the inspector. Here is my script-

#pragma strict

var RocketAmmoTakeUp = 1;
public var rocketPrefab : Rigidbody;
public var barrelEnd : Transform;
var RocketAmmo = 5;
var HasRocketAmmo = true;


function Update ()
{
    if (HasRocketAmmo == true)
    {
    	if(Input.GetButtonDown("Fire1"))
    	{
       		 var rocketInstance : Rigidbody;
        	 rocketInstance = Instantiate(rocketPrefab, barrelEnd.position, barrelEnd.rotation);
       		 rocketInstance.AddForce(barrelEnd.forward * 2500);
       		 Destroy (gameObject);
       	}
    if (Input.GetButtonDown("Fire1"))
    { 
    	RocketAmmo -= RocketAmmoTakeUp;   
    }
    if (RocketAmmo <= 1)
    {
    	HasRocketAmmo = false;
    }
    if (RocketAmmo >= 0)
    {
    	HasRocketAmmo = true;
    }
}
}

What do you mean by “an values”? Are you aware that a Transform variable only accepts a Transform? :slight_smile: You should be able to drag & drop a transform into the variable’s field inside the inspector. You can’t type in any float values for xyz position and rotation. For that, you’ll have to use Vector3s and Quaternions.