【酷熊科技】工作积累 ----------- 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;
case 1: //金币
ResourcePath.Icon.money = "Icon/money";
path = ResourcePath.Icon.money + "/" + "gold";
mustGetRewardIcon.sprite2D = NGUITools.LoadAsset<Sprite>(path);
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步