2D Toolkit Forum
2D Toolkit => Support => Topic started by: fsadeq 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.
-
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
tk2dSystem.CurrentPlatform = "1x";
Any thoughts? Thanks.
-
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.
-
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..
-
Does it work if you set CurrentPlatform in a different scene before loading the main scene?
-
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.
-
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.
-
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?
-
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?