Hello Guest

Author Topic: Auto detect iphone version>?  (Read 3991 times)

bluelotus

  • Newbie
  • *
  • Posts: 18
    • View Profile
Auto detect iphone version>?
« on: December 03, 2012, 07:18:20 am »
So I've noticed there is a platform setting in the sprite collections now with 1x, 2x, 4x.
I guess I am wondering how I can reference the one sprite collection/atlas but set this parameter to 1x if iphone 3g, 2x if 4.

Had a look online could not find info.

Is there code to detect iphone version and set sprite collection size multiplier? 

Also, multiplying the size of the sprite sheet will also multiply the positions(coordinates) of objects?

Keen to find out about this stuff.  ;)

Cheers,

BL.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Auto detect iphone version>?
« Reply #1 on: December 03, 2012, 12:50:25 pm »
You can get these from the Unity functions.

For example, iPhone.generation will identify the iOS device:
http://docs.unity3d.com/Documentation/ScriptReference/iPhone-generation.html

You can also get some more info from here:
http://docs.unity3d.com/Documentation/ScriptReference/SystemInfo.html

Changing the sizes (1x / 2x / 4x) will scale the sprites appropriately that they are the same physical sizes. No need to touch coordinates on your part, but for sanitys sake you should start with 1x sprites and go up. Going down is possible, but you will need to make sure your sprite anchor points will divide properly, etc.

bluelotus

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: Auto detect iphone version>?
« Reply #2 on: December 13, 2012, 12:51:26 am »
Thanks unikron,

Good to know - I also saw someone detecting screen size and then scaling sprites.

Time to rescale everything back to 1!  :)

Cheers,

BL.