Error on Destroy

I have the same code as the lecture however it keeps sending an error an object is destroyed?

private void Die()
    Instantiate(explosionDeath, transform.position, Quaternion.identity);
    Destroy(explosionDeath, explosionLingerTime);


Edit: Strangely i fixed it by removing the codeline Destroy(explosionDeath, explosionLingerTime);
It still functions as expected and have the explosion VFX, however it does not clear the game of explosion gameobjects.

Resolved, I didn’t initialize the Instantiate with GameObject explosion, and tried to destroy the wrong variable.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms