Hello Guest

Author Topic: Asset Bundle Support  (Read 6189 times)

michael.ltn

  • Newbie
  • *
  • Posts: 1
    • View Profile
Asset Bundle Support
« on: July 06, 2015, 09:24:43 pm »
Using 2D Toolkit version 2.5.4 and Unity 5.0.3f2.

Target platform is WebGL.

I have platform support enabled and would like to be able to detect the available RAM the user has to determine which level of quality to load (1x, 2x, 4x).  Unity 5 now includes variant support; is this compatible with 2D Toolkit's platform support in any way?  If so, how should I set this up?

I've been working on a project that previously had platform-specific Asset Bundles working in Unity 4.6.  This was was done by updating tk2dSystem.LoadResourceByGUIDImpl<T> so that it loaded the resource from an AssetBundleManager instead of Resources.  There were a few other changes I had to make, but essentially when Rebuild Indexes was called, I would have another script create reference files in json format that mapped things like asset GUI to resource name, asset path to GUID, etc.  Once this was complete, the script built the asset bundles accordingly.

Since upgrading to Unity 5, the Asset Bundle pipeline has changed resulting the requirement of having to re-write the Asset Bundle Manager.  Where I'm stuck is I can assign each of the tk2dSpriteCollections to various asset bundles, and I have a list of the bundles I need to load for any given scene so I can ensure that the bundle is available before the scene is loaded.  But versioned assets load the appropriate Sprite Collection by first loading a tk2dResource files that points to that object.  I assume that these files need to be included in the Asset Bundles as well, but before I started manually trying to figure out which of these files need to be assigned to which bundles, I thought I'd check here to make sure I haven't missed some far more simple solution.

rxmarcus

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Asset Bundle Support
« Reply #1 on: October 21, 2015, 11:34:17 pm »
I'm in the same boat, wondering if I need to ditch 2DTK for simplicity sake to get my asset bundles working. I like the idea of using 2DTK for saving on file size by using the atlas, but not sure how to make things work out with Asset Bundles. I'm following the Asset Bundle tutorial that was released this past month : http://unity3d.com/learn/tutorials/topics/scripting/assetbundles-and-assetbundle-manager?playlist=17117

The main issue I'm seeing is that I'm getting a "hash collision" I think from the same naming of sprite collection materials when I try to Build my Asset Bundles.

"Building AssetBundle failed because hash collision was detected in the deterministic id generation.
Conflict happened between Asset "Assets/$root/AssetContent/Volume2/SpriteCollections/BuildAScene/V2BS_Collection@2x_3 Data/atlas0 material.mat" and "Assets/$root/AssetContent/Volume2/SpriteCollections/Props/V2Props_Collection@2x_1 Data/atlas0 material.mat"."

Any guidance / steps to take would be a huge help to all of us wanting to figure this out.
« Last Edit: October 21, 2015, 11:36:19 pm by rxmarcus »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Asset Bundle Support
« Reply #2 on: October 23, 2015, 06:08:37 pm »
I think you've got platform collections enabled -
I don't understand why you'd need platform collections using asset bundles... it was built for a very specific purpose and that was to transparently load correct assets in a game. It assumed all the assets were available on the device, but just loaded the correct one. If you're downloading asset bundles, you'd surely want to just download the appropriate one for the device you're running? You don't need platform collections for that, just multiple sprite collections each with their own data (and maybe same settings on them). Is that what you're trying to do?