📅  最后修改于: 2022-03-11 14:49:09.450000             🧑  作者: Mango
void OnCollisionEnter2D(Collision2D collision)
{
Destroy(gameOnject);
}
// Or if you only want it to be destroyed when
// hitting something specific
void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.tag == "tag")
{
Destroy(gameObject);
}
}