Unity NGUI UISprite 图集替换

public static bool ChangeAtlas(this UISprite ui, string atlaspath)
{
if (ui == null || string.IsNullOrEmpty(atlaspath))
{
return false;
}
if (ui.atlas == null || ui.atlas.name != atlaspath)
{
UIAtlas ua = Resources.Load (atlaspath, typeof(UIAtlas)) as UIAtlas;
if (ua != null)
{
ua.name = atlaspath;
ui.atlas = ua;
return true;
}
else
{
return false;
}
}
else
{
return true;
}
}

你可能感兴趣的:(成长的程序员)