- Home /
SpritePacker not working on bundles
Hi,
In the editor my sprites are packed. But when I build an asset bundle, the same sprites in the bundle are not packed.
I have a system that builds 3 sets of bundles for different platforms (iOS, Android, OSX). It automatically switches platform, builds the bundle then moves on to the next. I never see the packing progress bar.
Is there anything I need to do in my scripts to get the sprites to be packed?
I am using Unity Pro 4.6.1 on OSX
I am using the Cache Server
In the Editor Settings I have set the sprite packer mode to "Always Enabled". I have also tried "Enable For Build", with the same result.
Everything about my asset bundle is working, except the packing.
I am building my bundle like this:
BuildAssetBundleOptions buildOptions = BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets; bool success = BuildPipeline.BuildAssetBundle(manifest, bundleObjects.ToArray(), Path.Combine(bundleDirectory, bundleName), out crc, buildOptions, target);
Any luck with this? I know this post is a few months old, but I'm having a similar issue and there doesnt seem to be many resources availabe on the internet for dealing with Sprites in AssetBundles for 4.6.. everything is pointing to Unity 5 for this now because of the new AssetBundle system.
Would love to know if you got this figured out and how you managed to load a sprite of a Texture2D with Sprite's option set to multiple from an assetbundle.
I never found a reliable solution. The issue seemed to related to memory usage. With very small bundles I could created them for all 3 platforms and they would all be packed. For the rest, I could get the first packed and built correctly. It was then significantly less likely to work for the 2nd platform, and always failed on the 3rd if it got that far. So in the end I had to manually switch targets and build the bundles for that target.
If you would like to see the skeleton code I used to pack up sprites into asset bundles let me know and I will post.
I ended up writing a solution that worked for me. Had to manually add all the sprites, AND the texture. Still haven't tested if this works with packed sprites or not, but I think it might. So the details of my solution were to grab all of the sprites as Sprite objects, and the texture as Texture2D, and put them all into the bundle as separate objects.
You can post your skeleton code if you like, I'd love to compare.
Your answer
Follow this Question
Related Questions
Can I know if the current scene has been loaded from bundle? 0 Answers
EditorSceneManager.OpenScene & AssetBundle 0 Answers
Best practices for updating/adding content with Addressables bundles 0 Answers
The AssetBundle can't be loaded because another AssetBundle with the same files is already loaded. 1 Answer
Bundle Cache Size 0 Answers