Assume the prefab creation works fine:
var prefab = PrefabUtility.CreatePrefab("Assets/Prefabs/myPrefab.prefab", myGameObject, ReplacePrefabOptions.Default);
Means “prefab” is not null.
But now I want to store/save the prefab in an AssetBundle. How is this archived?
My try:
var buildMap = new List<AssetBundleBuild> {
new AssetBundleBuild {
assetBundleName = "MyPrefab in an AssetBundle",
assetNames = new [] { AssetDatabase.GetAssetPath(prefab) }
}
};
var manifest = BuildPipeline.BuildAssetBundles("Assets/AssetBundle/uweTest.unity3d",
buildMap.ToArray(),
BuildAssetBundleOptions.None,
BuildTarget.StandaloneWindows);
Any help would be great!
Thanks in advance!