title: gameObject out of screen edge
body: <p>I have this piece of code from my 2D game character. It's working fine on respawning my character on random Screen positions, but the problem is that this code works with my game caharacter Center, I mean it generates the center position to a Random Range and there on the edge of the screen my chracter is going half out of the screen... I need this code working on any Android device and i dont know how i can solve this. Anyone a simple solution? </p>
  
  <p>Sorry for my beginner english. </p>
  
  <pre><code>//Generate Random X
      float generateX()
      {
          float x = Random.Range(Camera.main.ScreenToWorldPoint(new Vector2(0, 0)).x, Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, 0)).x);
          return x;
      }
  
      //Generate Random Y
      float generateY()
      {
          float y = Random.Range(2.0f, Camera.main.ScreenToWorldPoint(new Vector2(0, Screen.height)).y);
          return y;
      }
  
  void generateCoordinates()
      {
          transform.position = new Vector2(generateX(), generateY());
      }
  </code></pre>