i want to destroy a game object that i instantiated and i get a lot of errors when i try to do so like "the name clone does not exist in the current context" , "cannot convert object expression to type UnityEngine.Object". i tried a lot of things i found online but nothing helps. here is my code :
if(distance<renderDistance)
{
if(!temp)
{
GameObject clone = Instantiate(chunk,transform.position,transform.rotation)as GameObject;
temp = true;
}
}
else
{
Destroy(clone);
}