Search Unity

Android tablet USB connection: Scale screen size?

Discussion in '2D' started by Mothil, Apr 23, 2015.

  1. Mothil

    Mothil

    Joined:
    Jan 14, 2014
    Posts:
    434
    I've used Unity quite a bit, but never actually fully tried making games for tablets/phones yet. I had a project while back, but I can't recall ever having problems with the camera and screen size then.

    whatswrong.jpg

    The camera preview is not how I see it on my Android tablet. On the tablet, the sprites are perfectly aligned in the corners, with just about the same distance to the sides as you see they have from top to bottom there. barely a couple millimeters.

    So my question is: What is the process of making the game scalable, so it fits every size of screen out there?
    Thanks in advance.
     
  2. hamsterbytedev

    hamsterbytedev

    Joined:
    Dec 9, 2014
    Posts:
    353
    It depends...if the sprites are UI then you would use anchor points. If the sprites are just regular in game kind of stuff then it should look the same on the device as long as the aspect ratio of your device is the same as the aspect ratio of the screen in the editor eg. 16:9, 16:10, etc. If the aspect ratio of your device is non-standard or different than the aspect ratio in the editor then there are tools available for it, but they are not free or easy to create. Good luck!
     
    Mothil likes this.
  3. Mothil

    Mothil

    Joined:
    Jan 14, 2014
    Posts:
    434
    I kind of find it odd I'm having so much problems with this. Here is a picture of my tablet, and how it looks:

    11180180_810655205655220_308968355_n.jpg

    It doesn't fill the camera. I created the doodle sprite in 160*90 pixels, and scaled it up (It's not at 1600*900).
    I'm googling and trying to find out how to fix this, so if somebody knows how to fix it, please do tell. :)
     
  4. hamsterbytedev

    hamsterbytedev

    Joined:
    Dec 9, 2014
    Posts:
    353
    What are those square at the edges? That's not part of your sprite right?
     
    Mothil likes this.
  5. Mothil

    Mothil

    Joined:
    Jan 14, 2014
    Posts:
    434
    The squares at the edges are 4 small sprites I used to find the edges of my tablet screen. You can also see them in my first post, whereas that's the screen size relative to the screen size on my tablet.
     
  6. hamsterbytedev

    hamsterbytedev

    Joined:
    Dec 9, 2014
    Posts:
    353
    If your intention is to use this sprite to cover the entire screen my advice is to add some bleed area to the outside of the image that is the same color as the surrounding sprites. This will insure that you don't have the camera BG showing through. Just make the image larger than it needs to be. Most often you aren't going to be using a single sprite to fill the entire screen unless it is a UI sprite in which case that is done VERY easily by just using anchors. Does that help?
     
    Mothil likes this.
  7. Mothil

    Mothil

    Joined:
    Jan 14, 2014
    Posts:
    434
    That's very valid. Now that you're mentioning it, I will probably never have one sprite cover the whole camera, so I shouldn't get caught up in that. Thanks for the help, though. It's very appreciated. :)
     
  8. hamsterbytedev

    hamsterbytedev

    Joined:
    Dec 9, 2014
    Posts:
    353
    No worries. Best of luck in all your future endeavours. If you ever have any questions you can reach me personally via my website or Twitter account. I have links in my signature.
     
  9. Kuan

    Kuan

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    87