/// <returns>The atlas or null if it could not be loaded.</returns>
public Atlas GetAtlas()
{
if (atlasFile == null) {
Debug.LogError("Atlas file not set for atlas asset: " + name, this);
Clear();
return null;
}
if (materials == null || materials.Length == 0) {
Debug.LogError("Materials not set for atlas asset: " + name, this);
Clear();
return null;
}
if (atlas != null)
return atlas;
try {
atlas = new Atlas(new StringReader(atlasFile.text), "", new MaterialsTextureLoader(this));
atlas.FlipV();
return atlas;
} catch (Exception ex) {
Debug.LogError("Error reading atlas file for atlas asset: " + name + "\n" + ex.Message + "\n" + ex.StackTrace, this);
return null;
}
}