Hello Guest

Author Topic: Loading Collections and Platform Support.  (Read 12021 times)

Dreamkind

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Loading Collections and Platform Support.
« Reply #15 on: December 04, 2013, 10:50:27 pm »
In my setup the 1x and 2x have their entries in tk2dSystem. When I click Loadable asset, none are added because the it only checks of loadable on the 1x and 2x, but not the main collection that manages the platforms.

After changing the code that creates the collections to save the Loadable setting and the AssetName. Now there is an extra entry in tk2dSystem for the collection that manages the platforms.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Loading Collections and Platform Support.
« Reply #16 on: December 04, 2013, 11:01:46 pm »
What version of tk2d / unity are you using? Whatever I posted in the previous post works fine in 2.3?

Dreamkind

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Loading Collections and Platform Support.
« Reply #17 on: December 04, 2013, 11:11:41 pm »
We are on 2.3.0. No matter what I have checked in the sprite collection editor for loadable a collection that has 1x and 2x platforms will only generate an entry int he tk2d resources folder for the 1x and the 2x data. I cant get it to generate a 3rd for the default one unless I modify the editor code.

I just made a fresh project and tried this, and it worked exactly how you said. Maybe our code didn't get fully carried over or the sprite collections upgraded. Is there anyway to check the version of the collection in the editor.

Edit: I am sorry for all of the confusion but I think I pinpointed the issue. In the fresh install it did create a 3rd entry in the tk2d resources folder, but when i did Rebuild Index that entry was deleted.
« Last Edit: December 04, 2013, 11:43:00 pm by Dreamkind »

Dreamkind

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Loading Collections and Platform Support.
« Reply #18 on: December 05, 2013, 04:02:26 pm »
I was trying to hold off on bumping this because I don't want to be spammy, but here is what I have found so far.

Making a sprite collection with platform support for 1x and 2x loadable means that it has 3 entries in the tk2dSystem, 1 for the collection, 1 for the 1x, and 1 for the 2x. Rebuilding the index removes the entry for the collection but keeps the entries for the 1x and 2x.

We are using svn, so this means that the tk2d Resource folder is ignored, and everyone rebuilds the index after updating causing the entry for the collection to be removed. It is possible to get this back by opening the collection editor and checking the loadable box on and off again (This does not require the collection to be committed). When this is present the data that gets loaded is not the platform data, and the sprite that shows up is for the correct platform.

If I rebuild the tk2d Index then the data that is loaded is always the 1x collection data. Normally this can be solved with the fix that I mentioned above, by toggling the collection loadable check box. However if unity is restarted after the index is rebuild (before the resource entry has been recreated) then it will continue to load the 1x graphics. Even if I toggle the loadable check box I need to commit the collection for it to load the platforms correctly, which is time consuming when we have around 45 collections to worry about.

This is with out any modifications to the source code.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Loading Collections and Platform Support.
« Reply #19 on: December 05, 2013, 06:32:56 pm »
I think you've found the issue here, and that explains why I wasn't seeing it. Building the index was incorrectly indexing things. It didn't matter for what the system was designed for, as it never used the name for anything but it broke for you as you did.

Try these changes - it should fix the names properly, and the loadable flag works as expected too.
tk2dSystemUtility.cs, around line 285
Code: [Select]
- MakeLoadableAsset(data, data.assetName);
+ MakeLoadableAsset(data, indexEntry.managedSpriteCollection ? " " : data.assetName);

tk2dSpriteCollectionBuilder.cs, around line 668
Code: [Select]
+ gen.spriteCollection.loadable = gen.loadable;
gen.spriteCollection.hasPlatformData = true;
gen.spriteCollection.spriteCollectionPlatforms = platformNames.ToArray();

These are from a current WIP build so line numbers might not match, but there should be enough context there to find those lines.
After that, rebuild the sprite collection. Subsequent reindexing should work fine.

Let me know how that goes for you.

Dreamkind

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Loading Collections and Platform Support.
« Reply #20 on: December 05, 2013, 10:27:06 pm »
Thanks, This works perfectly in our test project. I will let you know if I encounter any problems but it seems to work fine.