我想销毁我实例化的游戏对象,当我尝试这样做时遇到很多错误,例如“名称克隆在当前上下文中不存在”,“无法将对象表达式转换为 UnityEngine.Object 类型”。我尝试了很多我在网上找到的东西,但没有任何帮助。这是我的代码:
if(distance<renderDistance)
{
if(!temp)
{
GameObject clone = Instantiate(chunk,transform.position,transform.rotation)as GameObject;
temp = true;
}
}
else
{
Destroy(clone);
}