如何动态更换同一图集的NGUI图片
首先目标的组件为NGUISprite而不是NGUITexture。
...
if (trans != null//目标图片
&& name.Length > 0//图片的名字,这个名字必须为相同图集里面所包含的对象
&& trans.GetComponent<UISprite>() != null)
{
trans.GetComponent<UISprite>().spriteName = name;
}//
...