Unity NGUI UISprite 图集替换

来源:互联网 发布:ipad直播软件 编辑:程序博客网 时间:2024/05/21 00:18
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;
}
}
原创粉丝点击