xxxxxxxxxx
public Camera cam;
Vector3 playerOnScreenPos = cam.WorldToScreenPoint(gameObject.transform.position);
if (playerOnScreenPos.x < 0 || playerOnScreenPos.x > Screen.width
|| playerOnScreenPos.y < 0 || playerOnScreenPos.y > Screen.height)
{
Debug.Log("Outside!");
}