资源简介
最近做mmo的时候发现有很多琐碎的icon,比如战场中的头像,小地图的icon之类的,占用了很多的draw call
为了节省draw call就找到了这个代码。

代码片段和文件信息
using DaVikingCode.AssetPacker;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
public class AssetPackerExample : MonoBehaviour {
public Image anim;
AssetPacker assetPacker;
void Start () {
// We just copy and paste files so you don‘t have to do it manually.
CopyPasteFoldersAndPNG(Application.dataPath + “/RuntimeSpriteSheetsGenerator/Demos/Sprites“ Application.persistentDataPath);
string[] files = Directory.GetFiles(Application.persistentDataPath + “/Textures“ “*.png“);
assetPacker = GetComponent();
assetPacker.OnProcessCompleted.AddListener(LaunchAnimations);
assetPacker.AddTexturesToPack(files);
assetPacker.Process();
}
void LaunchAnimations() {
StartCoroutine(LoadAnimation());
}
IEnumerator LoadAnimation() {
Sprite[] sprites = assetPacker.GetSprites(“walking“);
int j = 0;
while (j < sprites.Length) {
anim.sprite = sprites[j++];
yield return new WaitForSeconds(0.1f);
if (j == sprites.Length)
j = 0;
}
}
void CopyPasteFoldersAndPNG(string SourcePath string DestinationPath) {
foreach (string dirPath in Directory.GetDirectories(SourcePath “*“ SearchOption.AllDirectories))
Directory.CreateDirectory(dirPath.Replace(SourcePath DestinationPath));
foreach (string newPath in Directory.GetFiles(SourcePath “*.png“ SearchOption.AllDirectories))
File.Copy(newPath newPath.Replace(SourcePath DestinationPath) true);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-04-30 10:37 UnityRuntimeSpriteSheetsGenerator-master\
文件 449 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\.gitignore
目录 0 2018-10-16 14:58 UnityRuntimeSpriteSheetsGenerator-master\.vs\
目录 0 2018-10-16 14:58 UnityRuntimeSpriteSheetsGenerator-master\.vs\UnityRuntimeSpriteSheetsGenerator-master\
目录 0 2018-10-16 15:00 UnityRuntimeSpriteSheetsGenerator-master\.vs\UnityRuntimeSpriteSheetsGenerator-master\v15\
文件 27648 2018-10-16 15:00 UnityRuntimeSpriteSheetsGenerator-master\.vs\UnityRuntimeSpriteSheetsGenerator-master\v15\.suo
目录 0 2018-10-16 14:58 UnityRuntimeSpriteSheetsGenerator-master\.vs\UnityRuntimeSpriteSheetsGenerator-master\v15\sqlite3\
文件 552960 2018-10-16 14:58 UnityRuntimeSpriteSheetsGenerator-master\.vs\UnityRuntimeSpriteSheetsGenerator-master\v15\sqlite3\storage.ide
目录 0 2018-10-15 17:09 UnityRuntimeSpriteSheetsGenerator-master\Assets\
目录 0 2018-10-15 17:09 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\
目录 0 2018-10-15 17:09 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\
目录 0 2018-10-15 17:09 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Scenes\
文件 12397 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Scenes\AssetPacker.unity
文件 174 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Scenes\AssetPacker.unity.me
文件 34317 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Scenes\RectanglePacking.unity
文件 174 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Scenes\RectanglePacking.unity.me
文件 191 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Scenes.me
目录 0 2018-10-15 17:09 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\sc
文件 1505 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\sc
文件 262 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\sc
文件 4805 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\sc
文件 262 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\sc
文件 191 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\sc
目录 0 2018-10-15 17:09 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Sprites\
目录 0 2018-10-15 17:09 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Sprites\Textures\
文件 13804 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Sprites\Textures\walking0001.png
文件 2265 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Sprites\Textures\walking0001.png.me
文件 13810 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Sprites\Textures\walking0002.png
文件 2265 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Sprites\Textures\walking0002.png.me
文件 13693 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Sprites\Textures\walking0003.png
文件 2265 2017-02-02 05:28 UnityRuntimeSpriteSheetsGenerator-master\Assets\RuntimeSpriteSheetsGenerator\Demos\Sprites\Textures\walking0003.png.me
............此处省略58个文件信息
相关资源
- Unity3D登录界面工程
- unity3d反编译工具
-
xm
l多个文件合并(delphi) - 收藏奉献_DOS汉字系统08:WPS 2.3 + CXD
- 收藏奉献_DOS汉字系统03:WPS 2.0 + 金山
-
UnityWebPla
yer及UnityWebPla yerFull -
UnityWebPla
yerFull - unity4.0官方正式版
- fastreport 向下合并单元格 修改文件
- excel合并单元格自适应行高的宏
- 合并多个DLL或EXE 工具+说明.rar
- Behavior Designer 1.6.3(u2018.3.0).unitypa
- Unity纪念碑谷.rar
- A Pathfinding Project Pro v4.2.2.rar
- Unity 声音播放插件,支持将字符串转
- Gaia 1.7.2
- Unity3d实现扭动挤压浏览效果
- UnityShader卷轴效果
- 文件合并助手
- 爱酱(绊爱Kizuna)模型
- 遗传算法越野小车unity5.5
- unity 3D 百度语音合成 并播放
- 基于Office2007开发的合并会计报表系统
- unity案例入门坦克大战源码
- Graph And Chart 1.91.unitypackage
- Animated Steel Coaster 1.51.rar
- Unity3D游戏开发.pdf 宣雨松著完整高清
- Excel合并大师破解版.zip
- Unity3D版水果忍者
- unity3d爆炸特效包
评论
共有 条评论