📜  如何使对象统一消失 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:17.749000             🧑  作者: Mango

代码示例1
public class Player : MonoBehaviour
{
    //Set this game object by dragging on UI
    public GameObject body;

    private void OnCollisionEnter2D(Collision2D other) {
      if(body != null){
        body.GetComponent().enabled = false;
        Destroy(body);
      }
    }
}