public class AtlasPair {
public string name;
public UIAtlas reference;
}
...
public AtlasPair[] atlasses;
UIAtlas atlasReference;
UIAtlas fontAtlasReference;
string qualitySuffix;
Dictionary<string, UIAtlas> instances;
void Start () {
instances
= new Dictionary
<string, UIAtlas
> (); qualitySuffix = (Screen.height <= 768) ? "low" : "high";
for (int i = 0; i < atlasses.Length; i++) {
if (atlasses[i].name.Length == 0) {
Debug.LogWarning ("[GUI] No name for element " + i, gameObject);
continue;
}
if (atlasses[i].reference == null) {
Debug.LogWarning ("[GUI] No atlas for element " + i, gameObject);
continue;
}
UIAtlas reference = Instantiate (atlasses[i].reference) as UIAtlas;
atlasses
[i
].reference.replacement = Resources
.Load ("Atlasses/" + atlasses
[i
].name + "_" + qualitySuffix,
typeof(UIAtlas
)) as UIAtlas
;
instances.Add (atlasses[i].name, reference);
}