Disable a script on another game object

I know there’s a lot of questions asking this question but the answers on the other questions don’t seem to have any luck with me. This is what I have:

    public GameObject missile;

    void OnTriggerEnter(Collider collide)
	{

		if(collide.gameObject.name == "powerup2")
		{
            Debug.Log("hit");
			//EnemyAI.speed = 2;
            missile.GetComponent<homingMissilePlayer>().enabled = true;
			Destroy(collide.gameObject);
			StartCoroutine(enemySpeed());
		}
    }

It’s giving me this error though:

NullReferenceException: Object reference not set to an instance of an object

The homingMissilePlayer script is on one of my missiles that is instantiated every few seconds, but I have dragged the prefab of the missile onto the object this script is on.

Can someone please tell me what I’m doing wrong please?

Is the variable missile, identified in the inspector? If it is then try to use missile = gameobject.find(“missile name”); in the beginning of you script.

If you are passing a prefab to the variable missile you are enabling the component of that prefab, not its instances.

Unity giving you a NullReferenceException for that line can only mean two things. First, you have not assigned the variable missile neither in the editor nor in the code. Second, the prefab has no homingMissilePlayer component.