- Home /
How do I save assets from an asset bundle in the Editor?
I have an assetbundle that contains an .fbx, textures, materials, prefabs and am attempting to load it into the Editor and create these assets in the asset folder.
I can easily load in the asset bundle and access the Object[] in the Editor using LoadAll(), but can't find a way to create the assets because AssetDatabase.CreateAsset() requires a path with an extension and I can't find a way to get the extension of the objects loaded from a bundle?
Is there another way to re-import AssetBundle assets into the Editor?
Thanks!
I have same issues. I want to Load an AssetBundle of Windows64 and resave those assets into another AssetBundle for other platform. But as this question said, how to include those loaded Objects to build another AssetBundle?
Answer by MasterLu · Dec 08, 2020 at 05:17 PM
I know its a little late, but here is my solution:
Object[] objects = assetBundle.LoadAll();
Object asset;
foreach (Object o in objects)
{
// make a copy, because the objects are allready in your assetDatabase and CreateAsset will exit with error when using the original object
asset = Object.Instantiate(o) as Object;
AssetDatabase.CreateAsset(asset, System.IO.Path.Combine("Assets", "AssetName.asset"));
}
Your answer
Follow this Question
Related Questions
How do I wait until after AssetDatabase creates an assets before carrying out another function ? 0 Answers
Converting XML-files into assets 1 Answer
Get dynamic persistent asset reference 0 Answers
Associate my custom asset with a custom EditorWindow 3 Answers
Generate a connected list consisting of scriptable objects. 1 Answer