Hello, Im hoping someone can help with assetbundles.
I am attempting to create bundles to minimize my disk space footprint on Android. I have a number of scenes that use the same prefabs(props) and terrain. A single scene is about all the device can load with the device's given memory. My hope is that I can create a common prop asset bundle, and a common terrain asset bundle from the scenes.
From these bundles I thought I could load the correct bundles and then load a scene.
(note the entire process would encompass 3 different sets of props subsets and a terrain)
Example of this (simplified!!)
Terrain
- T1
- T2
- T3
Props
- A
- B
- C
- D
- ...
Scenes
- S1 uses T1 and A &B
- S2 uses T1 and B,C&D
- S3 uses T2 and A&C
- S4 uses T2 and B&D
- ... and so on
Here is the code im using to create my list of asset objects, (side note: I am using a call to GetDependencies on the scene.unity file and intersecting that with my prop path to get only the prop prefabs which are passed to the code below to gather only the props and their dependencies)
public HashSet m_assetPathNames;
...
string[] dependencies = AssetDatabase.GetDependencies(new string[] { prefab});
foreach (string d in dependencies)
m_assetPathNames.Add(d);
Once I have collected the unique set of assets and their dependencies, I call this {m_dataToSave is a List<> created from the hashset)
BuildPipeline.PushAssetDependencies();
Object[] assets = m_dataToSave.ConvertAll
↧