Need Help with a Null Reference

Error :
NullReferenceException: Object reference not set to an instance of an object
PoisonCloudHealthAdjustment.OnTriggerStay (UnityEngine.Collider other) (at Assets/Scripts/PoisonCloudHealthAdjustment.cs:16)

    using UnityEngine;
    using System.Collections;
    
    public class PoisonCloudHealthAdjustment : MonoBehaviour {
    	
    	IEnumerator TriggerPause(int wait, GameObject pauseObject)
    	{
    		pauseObject.collider.enabled = false;
    		yield return new WaitForSeconds(wait);
    		pauseObject.collider.enabled = true;
    		
    	}
    	void OnTriggerStay(Collider other){
    		if(other.tag == "Player" )
    		{
    			if(gameObject.GetComponent<CreatePlatforms>().gameMode == 2) gameObject.GetComponent<PlayerHealth>().curHealth -= 1;
    			StartCoroutine( TriggerPause(2, gameObject) );
    		}
    	}
    	void Start()
    	{
    		StartCoroutine( TriggerPause(1, gameObject) );
    	}
    }

Is the Coroutine messing up the collider or something?

Thanks :slight_smile:

I fixed it … CreatePlatforms is on a different gameObject. /facepalm