资源简介
最近做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个文件信息
相关资源
- Unity调用打印机服务,Asset Store插件
- LegacyImageEffects资源包.zip
- 实时遮挡剔除 无需垬焙
- Unity3D中使用串口收发数据,仅供参考
- unity动作
- 完整的stealth项目,以及制作视频
- unity插件 build report tool
- cameraplugin.aar
- Unity飞机大战源码,完整工程
- Unity3D Basketball 篮球游戏 完整源码工程
- unity多种风格老虎机源码.txt
- 多人网络斗地主开发实战基于(Unit
- unity树状图插件TreeView
- word/doc文档合并器能自己添加文件名
- Timer.unitypackage
- Easy Save 3.0.3
- 同名文本文件合并器 可将两个文件夹
- Unity5.x3d游戏开发技术详解与典型案例
- Unity物体按角度移动
- 石子合并 在一个圆形操场的四周摆放
- 年度史诗MOMO ARPG 《泰斗破坏神》全套
- JCD_Highlighting.unitypackage
- ShuiBoWen.unitypackage
- graph and chart 手册
- polynav2D.zip
- uSpeak.zip
- On Screen Keyboard.zip
- DotweenPro 1.0.244.unitypackage
- ExcelTools.rar
- unity-横向比较unity3d与其他的游戏引擎
评论
共有 条评论