- Home /
MoveAround Failed Fire Ball
İm code Error. Please Help Me.(UnassignedReferenceException: The variable bullitPrefab of 'MoveAround' has not been assigned. You probably need to assign the bullitPrefab variable of the MoveAround script in the inspector.)
var speed : float = 3.0;
var rotateSpeed : float = 3.0;
var bullitPrefab:Transform;
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);
if(Input.GetButtonDown("Jump"))
{
var bullit = Instantiate(bullitPrefab,
GameObject.Find("spawnPoint").transform.position,
Quaternion.identity);
bullit.rigidbody.AddForce(transform.forward * 200);
}
}
@script RequireComponent(CharacterController)
Comment
Answer by speedything · Aug 02, 2012 at 09:36 AM
The error code you receive suggests that the problem is you haven't assigned the bullitPrefab.
In the script component's inspector, drag the prefab object onto the field marked "Bullit Prefab".
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Script Not Working At All.... :) (SOLVED) 1 Answer
How to disable lighting on text ? 1 Answer
Picking up an object 1 Answer