- Home /
AssetBundle Creation Problem
Hello,
I have a script that creates a prefab in order to create an AssetBundle from it (this part of the Unity API is really a mess!!!).
My script runs perfectly the first time but crash with the following error the second time:
Inconsistent asset when sorting preload assets: '' fileID: 0
UnityEditor.BuildPipeline:BuildAssetBundleInternal(Object, Object[], String[], String, BuildAssetBundleOptions, BuildTarget)
UnityEditor.BuildPipeline:BuildAssetBundle(Object, Object[], String, BuildAssetBundleOptions, BuildTarget) (at C:\BuildAgent\work\842f9557127e852\Editor\MonoGenerated\Editor\BuildPipeline.cs:55)
Here a the code I use to create the AssetBundle:
var prefab = EditorUtility.CreateEmptyPrefab("myPrefab.prefab");
EditorUtility.ReplacePrefab(myObject.gameObject, prefab, ReplacePrefabOptions.ConnectToPrefab);
AssetDatabase.Refresh();
BuildPipeline.BuildAssetBundle(AssetDatabase.LoadMainAssetAtPath("myPrefab.prefab"), null, "myBundle.unity3d", BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.StandaloneWindows64);
AssetDatabase.Refresh();
My gameobject is a simple Asset model in my project.
If you have any clue please share ;-)!
Thx
Answer by BigBulle · Aug 03, 2011 at 08:54 PM
I think that the reason of my problem was that the second time, I was creating an AssetBundle of a prefab created from an AssetBundle... I've changed my design to not do that. And now it works...
Answer by Lermy KefSensei · Jul 08, 2015 at 09:00 AM
Perhaps you are having the same issue from this post. Hope it helps!
Your answer
Follow this Question
Related Questions
How to import the object from server to unity 2 Answers
Load 3D model from external drive in runtime without using Assetbundle ? 1 Answer
How to auto find a component inside an assembly (dll)? 0 Answers
Load scene with navmesh from asset bundle 1 Answer
apply texture on OBJ files automatically in batchmode 1 Answer