How do I save a gameObject to a list so i can destroy in the scene?

I am trying to create an inventory system and when I add a weapon to the player, I remove the weapon from the inventory list and try to add the weapon that is currently equipped to the inventory list:

if(port1.transform.childCount > 0)
	GameObject obj = port1.transform.GetChild(0).gameObject;
	Destroy( port1.transform.GetChild(0).gameObject);
GameObject weap = (GameObject) Instantiate(itemToEquipt);
weap.transform.parent = port1.transform;
weap.transform.localPosition =;
weap.transform.localRotation = Quaternion.identity;
itemToEquipt =null;

I get an error that the gameobject was destroyed and I’m still trying to access it. is there a way I can save an instance of the weapon previously attached without keeping it in the scene? the weapon gameobject has information I want to preserve (damage/accuracy/etc).

The answer is: No! You can’t “store” a GameObject somewhere else then in the scene. The only exception are prefabs. They are instances but not in the scene, but prefabs can’t be created at runtime. You have to keep the object in your scene. Just disable it with SetActive(false).