unity 判断物体位置是否超出屏幕范围,超出范围自动复原
defaultWorldPos为初始位置
Vector3 value = Camera.main.WorldToScreenPoint(transform.position);
if (value.x > Screen.width || value.x < 0 || value.y < 0 || value.y > Screen.height)
{
transform.position = defaultWorldPos;
}