- Home /
Question by
Jeff-Kesselman · Dec 28, 2013 at 01:02 AM ·
assetsassetdatabasebundles
Cannot save a generated texture as part of a bundle
I am generating preview textures and need ro save them in my bundle. My first problem was that they had no associated asset, so now Im creating assets like this:
foreach(TileRecord rec in editee.tileList){
AssetDatabase.CreateAsset(rec.PreviewImage,
"Assets/Scenes/TilesetEditor/Assets/images/"+rec.name+"_preview.asset");
}
However now when I go to save the bundle all the preview assets throw this error:
An asset is marked as dont save, but is included in the build:
Asset: 'Assets/Scenes/TilesetEditor/Assets/images/room-floor_preview.asset'
Included from scene: 'Assets/Scenes/Main Menu/Main Menu.unity'
UnityEditor.BuildPipeline:BuildAssetBundle(Object, Object[], String, BuildAssetBundleOptions)
TilesetInspector:ExportTileset(Tileset) (at Assets/Scenes/TilesetEditor/editor/TilesetInspector.cs:189)
TilesetInspector:ExportAssetAsBundle(MenuCommand) (at Assets/Scenes/TilesetEditor/editor/TilesetInspector.cs:175)
It seems like i need to set them savable somehow but I can't figure out how.
Comment
Best Answer
Answer by Jeff-Kesselman · Dec 28, 2013 at 03:20 AM
Figured it out. I had to set the hideFlags on the created Texture2D.
On to the next issue,...
Your answer
![](https://koobas.hobune.stream/wayback/20220613125009im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Where are asset labels stored? 1 Answer
Get prefab's path in file system 2 Answers
ImportSettings error 0 Answers
When to use AssetDatabase API ? 0 Answers
How to put script assemblies into asset bundles and preserve public values? 1 Answer