首页 > 代码库 > 【酷熊科技】工作积累 ----------- Unity3D 读取 图片
【酷熊科技】工作积累 ----------- Unity3D 读取 图片
UISprite2D spMoney;
// 钻石建造卷图标
string path = ResourcePath.Icon.money + "/" + ""; // 读取本地路径
spMoney.sprite2D = NGUITools.LoadAsset<Sprite>(path); // 将读取的路径转化成sprite格式
// 金币建造卷图标
Texture2D textureGoldBuild = Resources.Load("Icon/money/") as Texture2D; // 将读取的本地的路径转化成Texture2D类型
Sprite spriteGoldBuild = Sprite.Create(
textureGoldBuild,
new Rect(0, 0, textureGoldBuild.width, textureGoldBuild.height),
new Vector2(0.5f, 0.5f)
);
spMoney.sprite2D = spriteGoldBuild;
【酷熊科技】工作积累 ----------- Unity3D 读取 图片