alright I’ve rewritten the entire question because it was rather unclear before;
What I am trying to do is instantiate a prefab that exists as a variable in another script.
class myClass { //Just a class to represent the
var item : GameObject; //class I have in my script
}
var a_Class : myClass = myClass();
function create () { //Instantiate the gameobject from "item"
Instantiate(a_Class.item,//position,//rotation);
}
The only issue with this script is that the item variable comes from a gameObject that has been destroyed…so when i try to instantiate it over again, i receive a “GameObject you are trying to access has been destroyed” error because the prefab from which i got the item variable has been removed from the game world.
what i need is a way to retain this prefab because the prefab that i am adding and removing from an array i have in the script is the same and has itself assigned to “item”.