Hello Guest

Author Topic: Multiple Res Unity Projects - Need Guidance  (Read 7983 times)

outtoplay

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Multiple Res Unity Projects - Need Guidance
« on: June 18, 2012, 04:29:34 pm »
Okay, I am trying to get a handle on this, and am hoping Unikron can explain what to do clearly.

Here's the project scope:
I am creating a 2D side scrolling game. I want to target iPad3 (2048x1536), 2 and 1(1024x768), as well as iphone4 retina(960x640) and potentially desktop(1920x1080).

I created my 2D backgrounds (the fullscreen sky at 2048x1536), I then created all my 2d sprite elements so they are sized correctly in a 2048x1536 psd.

Now...  in Unity, I start a new project, set it for mobile, delete the main camera and create a tk2d camera (Ortho, size=1536, Force Resolution in Editor to 2048x1536). Do the annoying offset thing to counter the Camera Preview bug.   Now my sprites look good in the Scene view and in the Game view (but obviously wrong in the camera preview window.

Here's the Questions:

1 - Given my setup, how do I ensure correct output for iPad3 native res.  And iPad 1-2 native res. and...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiple Res Unity Projects - Need Guidance
« Reply #1 on: June 18, 2012, 05:52:15 pm »
The difference between the two camera types.

With a tk2dCamera - it will attempt to make everything you see in the game window 1:1 all the time. So, if you have a 2048x1536 image, it will ALWAYS display at that size on any device. In your example, when running at iPad1/2 native res, you'll see only a quarter of the image. The origin of the tk2dCamera is the bottom left of the screen, so you'll see the bottom left quarter of your image. In order to get this to display to fill the screen here, you will need resolution overrides for 1024x768, and set the scale to 0.5 there. Thats telling Unity to display everything at 0.5x at 1024x768. Everything will then fit the display. On iPhone4, you'll see a cropped 960x640 image there, unless you use a resolution override.

With a normal ortho camera - set the ortho size of the camera to a number. This can be any number. Set the same number to the ortho size parameter in the sprite collection and commit. Also, make sure the sprite collection "target height" parameter has the correct resolution there, so if you're targetting 2048x1536, then the value there should be 1536. When you create this sprite in the viewport, it should fill the screen, regardless of the resolution. Even if your res = 1024x768, it should fill the screen. It will scale the image to fit the height on an iPhone4, but you'll see 2 bars on either side.

Hope that makes sense.

I'll post about different aspect ratios next - that is very game dependent. The more I know about your game and how you wish to use the sprites, the better recommendation I can make here.

outtoplay

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Multiple Res Unity Projects - Need Guidance
« Reply #2 on: June 18, 2012, 06:33:53 pm »
Thanks for the info Unikron. I will send you an email with a screen shot and more info and a small stand-alone player that test's the main character. Basically, I want to build this 2d scroller at the best initial resolution so it can work as a Universal app for IOS. This includes iPad3's high res screen down to iPhone 4's 960x640. 

I'm just not sure how to build with sprites that fit correctly on a 2048x1536 screen, and not be wasting memory when it it played by someone who owns an iPad 1 at 1024x768.

Thanks for the extra effort, your time is very much appreciated.

B.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Multiple Res Unity Projects - Need Guidance
« Reply #3 on: June 18, 2012, 08:32:20 pm »
Version 1.8 will address the "multiple atlas" problem directly. For now though, if leave mipmaps on, and then use QualitySettings to set to a different quality setting when you detect an iPad2 etc. You can set up the other quality setting to have half res textures.

Siddharth3322

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Multiple Res Unity Projects - Need Guidance
« Reply #4 on: January 31, 2014, 07:49:36 am »

With a tk2dCamera - it will attempt to make everything you see in the game window 1:1 all the time. So, if you have a 2048x1536 image, it will ALWAYS display at that size on any device. In your example, when running at iPad1/2 native res, you'll see only a quarter of the image. The origin of the tk2dCamera is the bottom left of the screen, so you'll see the bottom left quarter of your image. In order to get this to display to fill the screen here, you will need resolution overrides for 1024x768, and set the scale to 0.5 there. Thats telling Unity to display everything at 0.5x at 1024x768. Everything will then fit the display. On iPhone4, you'll see a cropped 960x640 image there, unless you use a resolution override.


How to do this? Please I want some information on this.