# UnityAssetDemo **Repository Path**: patrick31415/unity-asset-demo ## Basic Information - **Project Name**: UnityAssetDemo - **Description**: Unity资源加载的Demo - **Primary Language**: C# - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2020-11-24 - **Last Updated**: 2023-10-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # UnityAssetDemo #### 介绍 Unity资源加载的Demo,自作主张地加入了自己写的定时器和缓动系统 #### 软件架构 ##### AssetLoader 所有资源通过 AssetLoader 加载 loader1 -> asset1,asset2,asset3 loader2 -> asset1,asset4,asset5 ... 加载器开始加载的时候,无论资源是否已经存在,资源的引用计数都会加一 加载器释放(析构)的时候,资源的引用计数都会减一 当资源的引用计数成为0,再等待若干时间,资源会被完全卸载。 ##### TimerController ```C# uint delayId = TimerController.Add(delaySecond, endCall); ``` 经过delaySecond的时间后会执行endCall() uint loopId = TimerController.Add(delaySecond, loopSecond, endCall); 经过delaySecond的时间后会循环执行endCall(),循环间隔是loopSecond ##### Tween ```C# uint tweenId = Tween.AlphaCanvasGroup(CanvasGroup, alpha, seconds, endCall, TweenType) ``` 因为渐变的方式和内容很多,所以这里举一个例子 传入的CanvasGroup会在seconds的时间里面把透明度缓动到alpha,变化完毕之后会执行endCall方法 TweenType指的是缓动曲线方式,默认是线性变化 TweenType.Linear #### 安装教程 1. 导入后,编译即可使用,通过菜单栏 Build/StreamingAssets/${platform} 编译; 2. 编译路径可以通过修改 Assets/Editors/Build/AssetBuilder.cs 的 localPath 变量; 3. 但是同时也要修改 Assets/Scripts/GameContent.cs 的 GetLoadPath() 方法,否则运行加载会报错; #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request #### 特技 1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md 2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) 3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) 6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)