How to make objects appear again after destroyed?

I was using a gameObject as a music player for seem less music between scenes with a dontdestroy script. I made a destroy script on button press as a mute button to destroy that object so the music would stop, but once the object is destroyed I don’t know how to get it back. Any help is appreciated!

Thanks!

You should not Destroy, but disable the object. This can be achieved with:

object.SetActive(false);

Where object would point to the GameObject you are trying disable (destroy). Once you need it again, you can just do:

object.SetActive(true);

If you need to have a fresh instance of the gameobject, you should look into prefabs.

1 Like

Thank You!I will try this and report back!

Never mind I found out a different method.