• Stars
    star
    148
  • Rank 248,707 (Top 5 %)
  • Language
    C#
  • License
    MIT License
  • Created about 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Unity AssetBundle Reporter

Unity AssetBundle Reporter

Unity AssetBundle 冗余检测与资源分析

原因

在使用 Unity 进行开发项目时,通常使用 AssetBundle 来进行资源打包,虽然在 Unity 5.x 版本里提供了更加智能的依赖自动管理,即如果依赖的资源没有显式设置 AssetBundle 名称,那么就会被隐式地打包到同一个 AssetBundle 包里面。而如果已经设置的话,那么就会自动生成依赖关系。

那么当被依赖的资源没有独立打包时,而此时又存在两个或以上 AssetBundle 依赖此资源的话,这个资源就会被同时打包到这些 AssetBundle 包里面,造成资源冗余,增大 AssetBundle 包的体积,增加游戏加载 AssetBundle 时所需的内存。

于是,检测 AssetBundle 资源的冗余,才好方便对其进行优化。检测冗余可以在未打包前对将要打包的资源做分析,但是这无法完全保证打包之后的 AssetBundle 完全无冗余,一是分析时无法保证正确无冗余,二是引用的内置资源无法剔除冗余,所以对打包之后的 AssetBundle 包进行检测才真正检查到所有的冗余。

实现过程

详见 http://blog.csdn.net/akof1314/article/details/78141789

支持平台

目前仅支持 Windows 平台,Mac 平台需自行解决 gdiplus.dll 报错问题。

使用说明

将插件包导入到工程,打包 AssetBundle 之后,调用检测的接口,如下所示:

/// <summary>
/// 分析打印 AssetBundle
/// </summary>
/// <param name="bundlePath">AssetBundle 文件所在文件夹路径</param>
/// <param name="outputPath">Excel 报告文件保存路径</param>
/// <param name="completed">分析打印完毕后的回调</param>
public static void AnalyzePrint(string bundlePath, string outputPath, UnityAction completed = null)

传入所需的参数即可,等待输出报告。另外注意一点,打包完 AssetBundle 就立即检测,这样才能在分析 AssetBundle 的时候,获取到正确的自定义脚本类信息,才能分析完全。过后再检测的话,自定义的脚本类可能被其他人所修改,那么就无法分析正确。Unity 5.4+ 支持场景资源分析,Unity 4.X ~ Unity 5.3 只支持非场景资源分析。

More Repositories

1

CoolFormat

CoolFormat Source Code Formatter
C++
532
star
2

Wiz.Editor.md

一个基于 Editor.md 构建的为知笔记 Markdown 插件
JavaScript
502
star
3

UnityAssetDanshari

Unity Asset Danshari 资源断舍离
C#
279
star
4

UnityParticleSystemPreview

Unity ParticleSystem Preview 粒子预览插件
C#
268
star
5

AnimationPath

A Unity Animation Path Preview Unity 动画路径预览工具
C#
127
star
6

uGUI_LinkImageText

Unity uGUI Text support insert link and image
C#
111
star
7

UnityTMProFontCustomizedCreater

Unity TextMesh Pro 文本组件之字体图集生成工具
ShaderLab
70
star
8

Wiz.UEditor

一个基于 UEditor 构建的为知笔记编辑器插件
JavaScript
49
star
9

Unity-TextMeshPro-DynamicText

Unity TextMeshPro DynamicText 动态文本组件
C#
49
star
10

Unity-ConsoleTiny

⚡ Console Tiny is a powerful replacement for Unity's editor console.
C#
44
star
11

UnityEditorListView

UnityEditor ListView Control
C#
42
star
12

Sublime-CoolFormat

A Sublime Text plugin for Source Code Formatter
Python
33
star
13

uGUISpriteInAtlasShader

Unity uGUI sprite shader
GLSL
32
star
14

Unity-EditorInternalsVisibleDemo

Unity Editor Internals Visible
C#
31
star
15

UnityAnimationCurvePopupMenu

Unity AnimationCurvePopupMenu (Copy, Paste)
C#
30
star
16

ObjectPickerAdvanced

Unity ObjectPicker Advanced 对象选择器
C#
28
star
17

UnityNavToCollider

Unity NavMesh To Collider
C#
22
star
18

Cocos2dxGame

Cocos2d-x Game Tutorials
C++
21
star
19

Wiz.Title.Cleaner

一个支持正则的为知笔记文章标题清理插件
CSS
19
star
20

UnityVirtualFolder

Unity VirtualFolder
C#
11
star
21

WPS_COOL_CSV

一个能够保存Unicode编码CSV文件的WPS插件
C#
11
star
22

UnityEditorLearn

Unity Editor Learn
9
star
23

UnityTools

Some useful tools
C#
8
star
24

decrypter_xrd

C++
8
star
25

Unity-Live2D-uGUI

Unofficial
C#
8
star
26

Unity-EditorConnectionExample

EditorConnectionExample
C#
8
star
27

UnitySpritePackerOverview

Unity Sprite Packer Overview
C#
8
star
28

ConvertVcproj

ConvertVcproj
C++
4
star
29

Wiz.Auto.Editor

一个支持自动选择编辑器的为知笔记功能增强插件
JavaScript
4
star
30

UnityBuiltinStyleIcon

Unity builtin styles and icons viewer
C#
4
star
31

WuHuanTools

Some Tools
C++
3
star
32

VisualStudioFileOpenTool

Visual Studio File Open Tool
C#
2
star
33

Unity-UI-MeshEffect

Unity UI MeshEffect
C#
2
star
34

akof1314.github.io

个人网站
HTML
1
star
35

Unity-DocRedirect

Redirect the Unity document to offline documentation 文档重定向
C#
1
star