0
点赞
收藏
分享

微信扫一扫

Unity实现精灵资源动态加载

private Sprite LoadSourceSprite(string relativePath)
{
//把资源加载到内存中
UnityEngine.Object Preb = Resources.Load(relativePath, typeof(Sprite));
Sprite sprite = null;

ExceptionHandler.Assert(() => { sprite = Instantiate(Preb) as Sprite; });

//用加载得到的资源对象,实例化游戏对象,实现游戏物体的动态加载
return sprite;
}



举报

相关推荐

0 条评论