Author Topic: Another Atlas switch issue  (Read 3288 times)

xito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Another Atlas switch issue
« on: July 03, 2013, 04:44:41 AM »
Hello Aren!
We are try to switch between sd and hd Atlas to use in Retina and non-Retina resolutions. For example, our sd atlas have an icon with 130x100 pixels and our hd atlas have this icon too, but in this case with 260x200. We are using pixel size too:  SD(1f) HD(0.5f). And our switching script is like this code:

  1. public class AtlasPair {
  2.         public string name;
  3.         public UIAtlas reference;
  4. }
  5. ...
  6.  
  7.  
  8. public AtlasPair[] atlasses;
  9.  
  10.         UIAtlas atlasReference;
  11.         UIAtlas fontAtlasReference;
  12.        
  13.         string qualitySuffix;
  14.  
  15.         Dictionary<string, UIAtlas> instances;
  16.        
  17.         void Start () {
  18.                 instances = new Dictionary<string, UIAtlas> ();
  19.                 qualitySuffix = (Screen.height <= 768) ? "low" : "high";
  20.                
  21.                
  22.                 for (int i = 0; i < atlasses.Length; i++) {
  23.                         if (atlasses[i].name.Length == 0) {
  24.                                 Debug.LogWarning ("[GUI] No name for element " + i, gameObject);
  25.                                 continue;
  26.                         }
  27.                        
  28.                         if (atlasses[i].reference == null) {
  29.                                 Debug.LogWarning ("[GUI] No atlas for element " + i, gameObject);
  30.                                 continue;
  31.                         }
  32.                        
  33.                         UIAtlas reference = Instantiate (atlasses[i].reference) as UIAtlas;
  34.                        
  35.                         atlasses[i].reference.replacement = Resources.Load ("Atlasses/" + atlasses[i].name + "_" + qualitySuffix, typeof(UIAtlas)) as UIAtlas;
  36.  
  37.                         instances.Add (atlasses[i].name, reference);
  38.  
  39.                 }
  40.  
  41.  

Our problem is: When We launch the app in sd all is correct, however when We launch this in HD, all the widgets keep their low size (I.E. 130x100 for my icon).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Another Atlas switch issue
« Reply #1 on: July 03, 2013, 05:52:18 AM »
The widgets are supposed to keep their size -- that's the whole point of SD/HD swap. Dimensions don't change, but pixel density increases.

xito

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 13
    • View Profile
Re: Another Atlas switch issue
« Reply #2 on: July 03, 2013, 06:20:43 AM »
Finally We use FixedSizeOnMobiles and all is ok!!!


Thanks.