Hi, is there a way to take a gameobject from the scene and store it into the list of a script? Then after that, destroy the scene gameobject without destroying the one in the list? Here is some code to illustrate my problem.
public List<GameObject> items; // A list of GameObjects
GameObject obj; // Let this be the GameObject from the scene
public void Example(){
items.Add(obj); // Store it in the list
Destroy(obj.gameObject); // Now destroy the object in the scene
}
The problem I’m having is that the object stored in the list is destroyed when I call the Destroy() object. Its like the scene gameobject and the object stored in the list are the same.
Is there a way to make a separate copy of the scene gameobject, store it in my list, then destroy the scene gameobject without affecting the one in my list?