- Home /
Missile script is suddenly giving errors
I tried making a bombing script, but in the proccess seem to have ruined my missile script. This
var missileSpeed : float = 10;
var missileBomb : Rigidbody;
function Update(){
if (Input.GetButtonDown ("Jump")){
var clone : Rigidbody;
missile = Instantiate(missileBomb, transform.position, transform.rotation);
missile.velocity = transform.TransformDirection (Vector3.forward * missileSpeed);
}
}
says: Assets/shooting/missile.js(6,9): BCE0049: Expression 'missile' cannot be assigned to. and: Assets/shooting/missile.js(7,17): BCE0019: 'velocity' is not a member of 'missile'.
It was working a second ago, but now it isn't. I deleted everything in the bombing scripts, as I altered this script to make it, but it didn't help.
Answer by Mortennobel · Apr 17, 2011 at 08:30 AM
I think the problem is that Unity has lost the reference to misileBomb (in the property editor - the right side of Unity UI). Try reassigning the rigidbody to the script-component and see if this works.
This error could happend if you have altered the script (such as renaming / removing variables).
Your answer
![](https://koobas.hobune.stream/wayback/20220613123258im_/https://answers.unity.com/themes/thub/images/avi.jpg)