generationjae.blogg.se

Unity assets bundle extractor
Unity assets bundle extractor









To solve this problem, load the Materials AssetBundle in memory before you load the AssetBundle that belongs to the module. In particular, if you only use a Prefab to instantiate a module, the Materials do not load. When you extract common Assets to a single AssetBundle, be careful about dependencies. This significantly reduces the size of the other AssetBundles for the Prefabs (from roughly 380 KB in the previous iteration down to roughly 20 KB). Now if you rebuild the AssetBundles, the generated output includes a separate modulesmaterials AssetBundle (359 KB), which contains the Material and its associated Texture. You can also tag the Material only, because the Texture dependency is also included in the AssetBundle automatically during the build process. To avoid data duplication, assign the Material and its referenced Assets to its own modulesmaterials AssetBundle.

unity assets bundle extractor

Data duplication across AssetBundles also impacts batching, because Unity considers each copy of the same Material as a unique Material. If the project contains a larger number of Prefabs, this behaviour impacts the final installer size, and the runtime memory footprint when both AssetBundles are loaded. In the example image below, the Prefab files have a size of 383 KB and 377 KB respectively. If you follow the AssetBundle Workflow and use the example class CreateAssetBundles to build AssetBundles, each generated AssetBundle contains the Material (including its Shader and referenced Textures). This Material references a Texture, which is not assigned to an AssetBundle. Both Prefabs share the same Material, which is not assigned to an AssetBundle. To prevent this duplication, assign common Assets (such as Materials) to their own AssetBundle.įor example: you could have an application with two Prefabs, both of which are assigned to their own AssetBundle. During build creation, Unity builds duplicates of any implicitly referenced Assets inside the AssetBundles. This page describes how Unity manages duplicated information across AssetBundles, and how you can apply optimization.īy default, Unity doesn’t perform any optimization to reduce or minimize the memory required to store duplicate information. These can affect memory resources and loading times. Assets which are used in multiple AssetBundles are known as common Assets. The prefab acts as a template from which you can create new object instances in the scene. This means multiple AssetBundles in your Project might contain the same information, such as a Material which is used by multiple Prefabs An asset type that allows you to store a GameObject complete with components and properties. Duplicated information across AssetBundlesīy default, Unity doesn’t optimize duplicated information across AssetBundles. In the next section, we’ll discuss how you can use the AssetBundleManifest objects we touched on in the previous section to determine, and load, dependencies at runtime. It does not matter which order you load Bundle 1 and Bundle 2, the important takeaway is that Bundle 2 is loaded before loading the Material from Bundle 1. In this example, before loading the Material from Bundle 1, you would need to load Bundle 2 into memory. Unity will not attempt to automatically load dependencies.Ĭonsider the following example, a Material in Bundle 1 references a Texture in Bundle 2:

unity assets bundle extractor

Should an AssetBundle contain a dependency, it is important that the bundles that contain those dependencies are loaded before the object you’re attempting to instantiate is loaded. If multiple objects in multiple bundles contain a reference to the same object that isn’t assigned to a bundle, every bundle that would have a dependency on that object will make its own copy of the object and package it into the built AssetBundle. In this case, a copy of the object that the bundle would be dependent on is copied into the bundle when you build the AssetBundles. A dependency See in Glossary does not occur if the UnityEngine.Object contains a reference to a UnityEngine.Object that is not contained in any AssetBundle.

unity assets bundle extractor

AssetBundles can become dependent on other AssetBundles if one or more of the UnityEngine.Objects contains a reference to a UnityEngine.Object located in another bundle.











Unity assets bundle extractor