Hello Guest

Author Topic: Help needed with Camera overrides  (Read 4409 times)

mygamingproject

  • Newbie
  • *
  • Posts: 37
    • View Profile
Help needed with Camera overrides
« on: July 13, 2014, 09:31:59 pm »
I am having issues with getting the camera overrides to work.

I have created the following:

- Setup Sprite collections with platform specific content for 1x, 2x and 4x
- Setup a camera and native state to be that of an iPad 3 - 4x Pixel Perfect
- Created a scene before anything else happens to determine the resolution and set the CurrentPlatform appropriately.  Its done in a separate scene to avoid any draw calls
Code: [Select]
public class ResolutionSetting : MonoBehaviour
{
void Awake ()
{
if(Screen.height <= 320)
tk2dSystem.CurrentPlatform = "1x";
else if(Screen.height <= 770)
tk2dSystem.CurrentPlatform = "2x";
else
tk2dSystem.CurrentPlatform = "4x";

Application.LoadLevel("Scene");
}
}
- I've created Overrides to the cameras for each of the iDevice resolutions (http://imgur.com/wzFBTKi)

The issue I am having is that the camera isnt being set when changing the Editor iOS prefixes.  The platform is changing but the overrides aren't/

I can't call it from my script as the camera resides in the other scene and even if I put to the game scene the awake call would be executed before the camera created.

When viewed in editor the camera doesn't change.  What am I doing wrong?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Help needed with Camera overrides
« Reply #1 on: July 14, 2014, 12:24:48 pm »
Platform sprite collections keep the sprites the same physical size regardless of resolution. This is so you don't have to reposition anything.
This means that you have to take that into account with the camera - a fit height / closest multiple of two here would be a good place to start. You don't need many overrides, just 1 wildcard one will work fine.

mygamingproject

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Help needed with Camera overrides
« Reply #2 on: July 14, 2014, 01:50:57 pm »
I thought with Pixel Perfect you needed to do more.

For example I have created my 1x, 2x, 4x assets which are 0.25, 0.5, 1 size multipliers so not sure I follow the same physical size comment you made as they wouldn't be for optimising texture memory reasons.

If you only had one wildcard I can see that works with something like a 480x320 to 960x640 (iphone3 & iphone4s) but that wouldn't accommodate the iphone 5 would it hence the need more more overrides I thought?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Help needed with Camera overrides
« Reply #3 on: July 14, 2014, 02:21:31 pm »
When the sprites are scaled, the physical size on screen remains the same. If the size doesn't remain the same, you'll have to reposition everything and that'll be a huge waste of time. fit height will work just fine, it will scale to fit on iPad - if you dont want that closest multiple of two will likely work a bit better. Try it and see what works best, you dont have to build it to device, just set your game window resolution to what you want to test.

Sprite collection 1x 2x 4x swaps are independent to camera resolution. Just get it to work with the camera, and swaps will just work.

mygamingproject

  • Newbie
  • *
  • Posts: 37
    • View Profile
Re: Help needed with Camera overrides
« Reply #4 on: July 14, 2014, 08:19:48 pm »
OK so with one override now of

- Match by: Wildcard
- Auto Scale: Closest Multiple of Two or Fit Height
- Fit Mode: Center

This works in the main with particularly better results with Fit Height however in both instances the iphone 5 wide view "squashes" the assets. 

What would you recommend for this resolution?

EDIT: think I have sorted it as FORCE RESOLUTION was on which was skewing the view
« Last Edit: July 14, 2014, 08:25:44 pm by mygamingproject »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Help needed with Camera overrides
« Reply #5 on: July 14, 2014, 10:37:55 pm »
I wouldn't recommend force resolution, use the unity game window resolutions to set stuff up. Its much more reliable / easier working that way.