Search Unity

Player gets out of camera range on android device

Discussion in 'Editor & General Support' started by Raaresh, Apr 24, 2015.

  1. Raaresh

    Raaresh

    Joined:
    Sep 9, 2014
    Posts:
    1
    Hi! I am very new to unity and game dev and i want to make a simple application with a ball and a ground that moves and you collect coins and avoid obstacles (like subway surfers, temple run etc). I followed a tutorial but i have one big problem.
    In unity it's working well. I move left and right and the ball stays in the camera range but if I try the app on a smartphone, if i keep the phone in a horizontal position and move the ball to the margins, the ball "disappears" and if i keep the phone in a vertical position , i need to move only a little to right or left and the ball gets out of the camera range.
    A simple, trivial method to avoid that is moving the camera back a little. But if I do that the player (the ball) will be far away and I don't want that.
    Any suggestions?
     
  2. martipello

    martipello

    Joined:
    Apr 28, 2015
    Posts:
    3
    I know you asked this a while ago now, and I'm also very new to unity but attempting a similar thing I have my camera attached to my player but I also have a canvas and when I rotate the device the canvas edges get lost there seems to be 2 ideas to fix this either 1. Call onScreenRotate you can change the layout of the canvas or camera in your case 2. Have 2 canvases or cameras, one portrait and one landscape and then hide whichever camera or canvas you want again in onscreen rotate but if you've solved this already let me know what you came up with