-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME
executable file
·159 lines (117 loc) · 6.65 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
NOTE: This project is no longer actively maintained by Unity. You are free to
use the code as-is or modify as needed in accordance with the provided license
for your own purposes, but there is no guarantee of performance or functionality,
and no support will be provided.
AssetBundle demo
----------------
This is asset bundle demo for Unity 5 which demonstrates what we can do in
the new AssetBundle system. Unity 5.0 beta 21 or later is required.
This Project and its Assets are designed to work with the AssetBundle Manager
lesson, which can be found on the official Unity "Learn" site here:
http://http://unity3d.com/learn/tutorials/modules/intermediate/editor/assetbundles
Explanation
-----------
The intent of the asset bundle manager is to provide a high-level API and a set
of editor utilities to build, test and use asset bundles in a refined workflow,
rather than using Unity's low-level AssetBundle API directly.
In this demo, we demonstrate:
- Automatic asset bundle dependency resolving & loading.
Dependencies between asset bundles are tracked in a single "Manifest" asset
bundle. This manifest holds information about all asset bundles and their
dependencies built for a particular target platform. In this way it's possible
to automatically resolve dependent asset bundles before the asset bundle itself
is downloaded.
- Automatic unloading of asset bundles. When an asset bundle or a dependency
thereof is no longer needed, the asset bundle is unloaded.
- Editor simulation. Allows to test the project in editor mode without actually
building the assetBundles.
- Optional setup in which all asset bundles are downloaded.
- Build pipeline postprocessor and integration so that building a player builds
the asset bundles and puts them into the player data (Default implementation for
loading assetbundles from disk on any platform).
- AssetBundle variants. A prioritized list of variants that should be used if the
asset bundle with that variant exists, first variant in the list is the most
preferred etc.
Editor utilities and High-level API
-----------------------------------
The editor utilities are accessible via Assets>AssetBundles menu. The following
utilities are provided:
Simulation Mode
This is used to control asset bundle simulation in the Editor.
When simulation mode is enabled, the editor is in play mode and asset
bundles are simulated based on the current build target. Asset bundles
can be "used" as if built and deployed without actually building them.
Asset bundle variants are not simulated in simulation mode.
Build AssetBundles
Builds the currently assigned asset bundles for the current target platform.
The built asset bundles are placed into "AssetBundles" folder on the root
of the project. This folder is configurable. Separate subfolders within
AssetBundles folder are used for each target platform.
Local AssetBundle Server
A local server is created allowing access to the built asset bundles. The
asset bundles can be accessed by any test application that has access to
the same local network as the computer that the editor runs on. This allows
to test the AssetBundle workflow of a project without having to actually
deploy built asset bundles.
For more information on the high-level API provided by the asset bundle manager,
see explanation in the AssetBundleManager.cs file.
Scenes
------
There're 4 scenes under Assets/TestScenes folder:
AssetLoader.unity
Demonstrates how to load a normal asset from asset bundle.
Additional information can be found in LoadAssets.cs script.
SceneLoader.unity
Demonstrates how to load a scene from asset bundle.
Additional information can be found in LoadScenes.cs script.
VariantLoader.unity
Demonstrates how to load variant asset bundle.
Additional information can be found in LoadVariants.cs script.
Asset bundle variants allow to load different version of the same asset
depending on user-defined settings. For example, it's possible to
configure low-end devices to use low resolution texture and high-end
devices to use high resolution texture.
In the demo, the following resources are built:
1. "My Assets HD" folder into "variant/myassets.hd" asset bundle.
This is "hd" variant of "myassets" asset bundle.
2. "My Assets SD" folder into "variant/myassets.sd" asset bundle.
This is "sd" variant of "myassets" asset bundle.
3. "variant-scene.unity" into "variants/variant-scene.unity3d".
This asset bundle contains a scene which uses variant asset bundle:
either from "myassets.hd" or "myassets.sd".
Assets within variant asset bundles must match across entire family of
variants. That is, if one variant provides an asset, all variants must
provide some asset with the same name.
Variant asset bundles always have an extension, which matches with
variant name. E.g. "myassets.hd" asset bundle is "hd" variant of
"myassets" asset bundle.
The active variant may be changed in LoadVariants.cs.
Please also refer to AssetBundleManager.RemapVariantName() to see how to
resolve the correct AssetBundle according to the active variant.
Asset bundle variants may not be simulated in editor.
TanksLoader.unity
Demonstrates how to load different variant asset bundles dynamically.
On iOS this scene works properly only if on-demand resources are disabled.
On-demand resource and App slicing usage on iOS
-------------------------------
In order to demo on-demand resources or app slicing, corresponding option must
be enabled in the player settings. No other changes are needed.
After loading scene, you should see something like the following in the
Xcode console:
[AssetBundleManager] Requesting bundle iOS through ODR
[AssetBundleManager] Requesting bundle cube-bundle through ODR
[AssetBundleManager] Requesting bundle material-bundle through ODR
The AssetLoader and SceneLoader scenes should result in flying cubes.
The Variant loader scene should result in different scenes depending on
devices: on iPads on should see "High-res" text, and "Low-res" text otherwise.
This scene demonstrates sliced resources that are loaded both on-demand and
statically included into initial application bundle.
License
-------
The project is released by Unity Technologies under the MIT/X11 license; see the
LICENSE file.
This means that you pretty much can customize and embed it in any software under
any license without any other constraints than preserving the copyright and
license information while adding your own copyright and license information.
You can keep the source to yourself or share your customized version under a
compatible license.