iLMS知識社群歷程檔登入
位置: 黃國哲 > Unity
1091222 摧毀物體
by 黃國哲 2020-12-22 15:16:34, 回應(0), 人氣(402)

摧毀物件的方法有兩種
1.摧毀物件

if (被撞物.gameObject.CompareTag("PickUp"))
{
Destroy(被撞物.gameObject) ;
}

2.隱藏物件

if (被撞物.gameObject.CompareTag("PickUp"))
{
被撞物.gameObject.SetActive(false) ;
}




回應