// find all LOADED UIAtlas components
UIAtlas
[] uiAtlases
= Resources
.FindObjectsOfTypeAll(typeof(UIAtlas
)) as UIAtlas
[];
foreach(UIAtlas atlasRef in uiAtlases)
{
// If this is a reference atlas and the atlas dosen't have a replacement...
if (atlasRef.name.Contains("-Ref") && atlasRef.replacement == null)
{
// Gets the name of the atlas that needs to be used (SD, HD or IPAD-HD)
string resAppropriatePath = GetCorrectReplacementAtlasName(atlasRef);
// Loads the new atlas
UIAtlas replacementAtlas
= Resources
.Load(resAppropriatePath,
typeof(UIAtlas
)) as UIAtlas
;
// Sets the new atlas as the replacment
atlasRef.replacement = replacementAtlas;
Debug.Log("UIHandlerClass setting replacementAtlas: "+replacementAtlas);
}
}