Issue instantiating an object with button click

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()

    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.

I’m assuming the missle is a prefab, put it into a folder with the name “Resources” and change “missle” to whatever your prefab is called.

clone = Instantiate(Resources.Load("missle"), shootPoint.transform.position, shootPoint.transform.rotation) as Rigidbody;

Why are you instantiating it as Rigidbody?

Instantiate as GameObject, then access rigidbody later.

At which line is the exception thrown? I am not 100% sure but if you only instantiate as rigidbody, it will not have it’s .gameObject which you are trying to access in the if tag comparison.