This is the unityscript code i have
#pragma strict
function Start () {
}
var prefabBullet:Transform;
var shootForce:float;
function Update ()
{
if(Input.GetButton("Fire1"))
{
var instanceBullet = Instantiate(prefabBullet, transform.position, Quaternion.identity);
instanceBullet.rigidbody.AddForce(transform.forward * shootForce);
}
}
and here is the error message
UnassignedReferenceException: The variable prefabBullet of ‘Shoot’ has not been assigned.
You probably need to assign the prefabBullet variable of the Shoot script in the inspector.
UnityEngine.Object.Internal_InstantiateSingle (UnityEngine.Object data, Vector3 pos, Quaternion rot) (at C:/BuildAgent/work/812c4f5049264fad/Runtime/ExportGenerated/Editor/UnityEngineObject.cs:44)
UnityEngine.Object.Instantiate (UnityEngine.Object original, Vector3 position, Quaternion rotation) (at C:/BuildAgent/work/812c4f5049264fad/Runtime/ExportGenerated/Editor/UnityEngineObject.cs:53)
Shoot.Update () (at Assets/Shoot.js:15)
Explain
inb4 formatting sucks