- Home /
Keeping a destroyed game object afterwards
I'm creating a weapon system for my game, and would like to know how to either keep a gameobject as a variable after it's been destroyed, or an easier way to do it without using a bunch of predefined prefabs that are the same object.
You can not.
Destroy clears the memory taken by your object.
Once you do that, the reference to that memory has no content - it is null.
If you use destroy you need to do instantiate (or "new" if it is a none unity object derived class).
Your answer
Follow this Question
Related Questions
using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers
Destroying object destroyable? 1 Answer
Switching Gameobjects in a variable 1 Answer
Checking Instantiate/Destroy has been called | Checking number of scene GameObjects 1 Answer
Destroy all GameObjects EXCEPT some... 2 Answers