Hello Guest

Author Topic: Platform Specific settings  (Read 5320 times)

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Platform Specific settings
« on: December 10, 2013, 08:08:22 pm »
So I started out with hi-res assets first and am deciding now down that road that I want to add 1x versions of textures. How do I set up the textures for this? From what I understand, I have to have the 2x/ folder relative to the source - but the source in my case is hi-res. Do I have to change my entire collection to reference the 1x texture, then move my 2x into the appropriate folder? Thanks.

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: Platform Specific settings
« Reply #1 on: December 10, 2013, 11:06:41 pm »
So I kept the source textures as the 2x ones and in that directory, I added a '1x' folder and put the 1x ones in there - seems to work in the editor. However, I don't see anything happening on the device? It keeps using the hi-res set of images even if I do

Code: [Select]
tk2dSystem.CurrentPlatform = "1x";
Any thoughts? Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Platform Specific settings
« Reply #2 on: December 11, 2013, 10:50:17 pm »
If the source textures are 2x and thats what thee collection is created with, then set it to 2x, and add a 1x override.
When do you call CurrentPlatform? It needs to be called before anything else. I.e. try Awake in a different scene to be sure its called for sure before trying to using the script execution order thingy.

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: Platform Specific settings
« Reply #3 on: December 11, 2013, 11:37:44 pm »
I'm calling it Awake of the only script in the start scene. I've tried changing the script execution order as well, to no avail.

I can verify that the sprite collections work properly because if I go to 2D Toolkit > Preferences > and switch the Platform, then I can see the textures swapping out to the proper ones.

Not sure why setting through code isn't working..

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Platform Specific settings
« Reply #4 on: December 12, 2013, 11:54:24 pm »
Does it work if you set CurrentPlatform in a different scene before loading the main scene?

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: Platform Specific settings
« Reply #5 on: December 13, 2013, 03:30:53 pm »
Yep, works only if I set it inside of a blank scene loaded before a scene that uses 2dTK.  Not sure why I can't get it to work otherwise, but I'm fine with this solution.

Only other thing I'm having trouble figuring out is using platform settings with Fonts. I have them included in my collection, but I'm not clear on what I'm supposed to do - I've tried exporting the bmfont into a "1x" folder, but when I do that I get errors telling me the atlas is too small for the sprites (not sure why since it's supposed to create a new atlas for the 1x, not put it in the same one), so I'm thinking something wonky is going on.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Platform Specific settings
« Reply #6 on: December 14, 2013, 04:07:59 pm »
You do exactly the same thing with fonts as you do with textures. You export a second font with @2x - be sure to export this properly from bmfont or whatever you use, so you end up with 2 fnt files, 2 textures. You put it in the same folder as you would the normal sprite textures and the rest just works.

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: Platform Specific settings
« Reply #7 on: December 14, 2013, 07:29:49 pm »
Yea - this isn't working for me. I'm either doing something horribly wrong, or there's a bug somewhere. I'm doing exactly the same thing I do for the normal sprites, exported fonts again, put them in the same directories like I'm doing with normal sprites, but whenever I commit the font collection, it tells me I have a texture that exceeds atlas size. This is what is confusing me - why is it trying to add textures to the original atlas?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Platform Specific settings
« Reply #8 on: December 15, 2013, 07:44:16 pm »
Bizzare. Can't reproduce this at all. Can you give me some more details of your setup, or set it up in a repro project & email support?