Hello Guest

Author Topic: Asset Bundles and Platform Specific Sprite Collections, Best Practices?  (Read 4723 times)

39thstreet

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 77
    • View Profile

Hello.  Having a bit of a problem with how best to handle our project which is going to be making significant use of asset bundles.

I have a 2dtoolkit project where significant portion of the game will be downloaded via scene assetbundles and separate object asset bundles.  I need to support 2x and 4x assets.

My original plan was to sacrifice size for convenience and include both in the asset bundles and let the sprite collections automatically take care of the 2x/4x decision.     But I do realize this is inefficient and more importantly based on tests and other threads here, platform sprite collections just don't work with asset bundles. 

So instead I made a separate sprite collection for each size, MyCollection2x and MyCollection4x.  Now what?  Two copies of every scene in the game?  Dynamically update the references in an export script and then save out 2x and 4x versions of my entire project?  Or just grab one copy and then update the references at runtime?   Every approach feels clunky.  What do other people do here?

Thanks in advance.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
There are better ways of doing this than is currently possible with tk2d. I'm investigating a couple options, one of them is to decouple the renderer and texture data in such a way that the correct platform collection is loaded when needed and is present (i.e. if its not available). I'm waiting to get rid of Unity 4.x support before I actually implement this though, so if you'd like a chat about how I planned on doing it I'll be happy to do so.

39thstreet

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 77
    • View Profile
Good to hear!

For the time being, what I'm doing is creating two asset bundles (a 2x and a 4x), keeping a reference to the two data files in my scene asset bundle.   

I'm setting up all the spites with the 2x, and then have a script which checks current platform on Awake() and swapping to the 4x then if appropriate.   This seems to be working so far on testing, although it all feels a little awkward.