Hello Guest

Author Topic: Resolutions Platform Support applying settings to all Sprite Collections  (Read 3958 times)

QUByte_Dev

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
I would like to know how hard / worth working would be implementing a controller for Platform Support, that I can then modify and apply the changes by rebuilding all collections with the new Platform settings I chose, instead of going manually one-by-one operation of open the collection, change Platform settings, then Commit.

If this is doable, could you please point me in the direction on how to modify the Platform settings that is saved in each of the collections by code?

There are any checklist I must conform to not corrupt the Collection data (like removing first LoadableAssets, then resseting Platform data, then writing the new data and saving asset)?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
It is possible. I'm assuming you know how to get to a tk2dSpriteCollection. At its core -

1. In tk2dSpriteCollection.platforms, add the platforms you need. Order doesn't matter, but the "size (1x, 2x, 4x)" of the first element (i.e. self) does matter so it knows what to do with the other platforms.

2. Call tk2dSpriteCollectionBuild.Rebuild( ... )

That should be it.


Removing platforms on the other hand, is a bit more of a pain, as you will need to delete the unused assets. Refer to tk2dSpriteCollectionEditorProxy.DeleteUnusedData() so you don't miss anything.

If you're planning on doing this, it might be worth investigating adding to the proxy, deleting the bits on the proxy and follow the code path the editor uses, so you won't have to maintain another duplicate set of code, but this in itself will add complexity.