- Home /
Destroying assets is not permitted to avoid data loss and var fix does not work between scripts
I cant destroy a prefab and everything ive seen tells me to define it as a var and then destroy that, but I can't do that across scripts. Is there other solutions to this issue?
This has already been asked many times. You just have to learn what you're actually storing in a variable. A reference to an asset or a reference to a gameobject in your scene. You cannot directly destroy an asset, but you can safely destroy any object already in your scene, such as Instantiated gameobjects.
Your answer
![](https://koobas.hobune.stream/wayback/20220613015903im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Main Camera problem between two scenes 0 Answers
Timer for destroying/ appearing Gameobject (Vuforia) 2 Answers
Destroy GameObjects before going to another scene to save Memory? Increase Performance? 1 Answer
How to play audio clip when destroying an object? 2 Answers
UI Object is there but can't destroy it. 0 Answers