📜  当物体移动到相机单位以下时销毁物体 - TypeScript 代码示例

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

代码示例1
void Update()
{
    Vector2 screenPosition = Camera.main.WorldToScreenPoint(transform.position);
    if (screenPosition.y < (Screen.height - 300f))
    Destroy(this.gameObject);

}