I want to fire a missile when I press on a button but the editor tells me the object has not been assigned when I’m sure it has been, the code I’m trying to use to instantiate is as follows:
public void fireMissile()
{
GUICounters.missiles--;
Rigidbody clone;
clone = Instantiate(missile, shootPoint.transform.position, shootPoint.transform.rotation) as Rigidbody;
clone.velocity = transform.TransformDirection(Vector3.forward * 200);
if (clone.gameObject.tag == "missile")
{
Destroy(clone.gameObject, 1.5f);
}
}
And this is the Inspector for my object:
As you can see, the bullet has been added and it is a rigidbody, yet when I click the button, I get the error that it has not been assigned, if anyone could help I’d appreciate it as it is driving me mad.