-
大小: 40KB文件类型: .zip金币: 1下载: 0 次发布日期: 2021-06-17
- 语言: 其他
- 标签:
资源简介
Unity的AssetBundle模块差异化打包工具,主要目的用于节省AssetBundle打包时间
代码片段和文件信息
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System;
using System.xml;
using System.Text;
///
/// unity5版本资源assetsbundle打包工具[强制更新的资源打包]
///
public class AssetsBundleTool : EditorWindow
{
const string notification = “1platform.2output dir.3build.“;
static string m_RootDirectory = ““;
//static string m_RootUnforce = ““;
static string mLastVersion = ““;
static string mVersion = ““;
static string mLog = ““;
static TargetPlatform m_TargetPlatform = TargetPlatform.StandaloneWindow;
static string m_Assets = “Assets/AssetData“;
static AssetsBundleTool window;
static AssetBundleManifest mAssetBundleManifest;
static List allDeps = new List();//存放被依赖的资源
static Dictionary mCacheAssetBund;
static Dictionary mPath2ABName;
static StringBuilder mStringBuilder = new StringBuilder();
public enum TargetPlatform : int
{
StandaloneWindow = (int)BuildTarget.StandaloneWindows64
Android = (int)BuildTarget.Android
IOS = (int)BuildTarget.iOS
}
[MenuItem(“Editor/资源打包/BuildAssetBundle &M“)]
static void CallBuildWindow()
{
window = EditorWindow.GetWindow();
window.maxSize = new Vector2(805f 1000f);
window.minSize = new Vector2(805f 500f);
window.titleContent = new GUIContent(“资源打包工具“);
window.autoRepaintOnSceneChange = true;
m_TargetPlatform = TargetPlatform.StandaloneWindow;
if (string.IsNullOrEmpty(m_RootDirectory))
{
m_RootDirectory = Application.persistentDataPath + “/AssetBundle/“ + m_TargetPlatform.ToString();//强制资源的输出路径
}
//m_RootUnforce = Application.dataPath + “/../../AssetBundle/unforce/“ +m_TargetPlatform.ToString();//非强制资源的输出路径
//xmlName = “UnforceStandaloneWindowxml.xml“;
GetSVNResversion();
}
static void GetSVNResversion()
{
mCacheAssetBund = new Dictionary();
var cachePath = Application.persistentDataPath + “/“ + GetPlatformFloder() + “_AssetBundleCache.xml“;
string cachetext = string.Empty;
if (File.Exists(cachePath))
{
using (FileStream fs = new FileStream(cachePath FileMode.Open))
{
int fsLen = (int)fs.Length;
byte[] heByte = new byte[fsLen];
//int r = fs.Read(heByte 0 heByte.Length);
fs.Read(heByte 0 heByte.Length);
cachetext = System.Text.Encoding.UTF8.GetString(heByte);
}
}
if (cachetext != string.Empty)
{
// mCacheAssetBund = new Dictionary();
xmlDocument xml = new xmlDocument();
xml.Loadxml(cachetext);
xmlNode node = x
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\
文件 66 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\.gitattributes
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\
文件 213 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData.me
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\
文件 213 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\material.me
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\material\
文件 1991 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\material\Mat.mat
文件 229 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\material\Mat.mat.me
文件 213 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\prefab.me
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\prefab\
文件 2733 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\prefab\cube.prefab
文件 231 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\AssetData\prefab\cube.prefab.me
文件 213 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Editor.me
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Editor\
文件 213 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Editor\AssetBundle.me
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Editor\AssetBundle\
文件 191 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Editor\AssetBundle\AssetBundleEditor.me
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Editor\AssetBundle\AssetBundleEditor\
文件 47048 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Editor\AssetBundle\AssetBundleEditor\AssetsBundleTool.cs
文件 284 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Editor\AssetBundle\AssetBundleEditor\AssetsBundleTool.cs.me
文件 213 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Scene.me
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Scene\
文件 9086 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Scene\Test.unity
文件 196 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\Scene\Test.unity.me
文件 213 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\sc
目录 0 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\sc
文件 11327 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\sc
文件 284 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\sc
文件 2821 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\sc
文件 284 2018-06-26 09:32 UnityAssetBundleBuildDiff-master\Assets\sc
............此处省略19个文件信息
评论
共有 条评论