Hello Guest

Author Topic: 2D Toolkit 2.2.2  (Read 26232 times)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
2D Toolkit 2.2.2
« on: October 12, 2013, 02:01:32 pm »
Please read the migration guide before updating. 2D Toolkit 2.x is not API compatible with 1.x.
http://unikronsoftware.com/2dtoolkit/docs/2.2/migration_guide.html

Documentation available at:
http://unikronsoftware.com/2dtoolkit/docs/2.2


What's new
  • Dicing quality massively improved - also added ability to filter solid and transparent dices. Documentation here
  • SortingOrder - you can now specify sorting orderon sprites and text meshes, allowing you to explicitly order sprites which are at the same z value.This used to be called RenderLayer in beta1
  • tk2dUI - you can now use multiple cameras! Add a tk2dUICamera behaviour to any cameras that require UI processing
  • tk2dUILayout and tk2dUILayoutSizer - lets you set up much more complex UIs than previously possible. Also enables for scalable UIs that resize properly for different resolutions. Docs:
  • tk2dUI - brand new default skin and prefabs, all set up using the Layout system for even quicker workflow
  • tk2dUI - new demos, webplayers below!
  • tk2dUI - added a lot more method bindings using the "Drop target" event - all currently exposed c# events can now also be accessed by selecting a function name in the inspector.
  • tk2dTextMesh no longer requires a commit after changing properties. The changed properties are queued up and flushed before the frame is rendered. You can still call Commit, and this flushes the queue straight away.
  • tilemap tiles can now be rotated. This is just a flag for now, but you can get all possible 90 degree rotations by stacking rotations and flips
  • Diced rendering mode, filtering option - you can only draw solid dices, or transparent dices - allows more advanced optimizations
  • tk2dCamera - removed a bunch of stuff from the internal camera settings. It now simply mirrors the hidden camera component.

Bug fixes and improvements
  • Setting value on tk2dUIScrollable Area resets inertial scrolling
  • Removed allocation from tk2dUIManager
  • Font editor - detect RGBA4444 in addition to ARGB4444 in Unity 4.2
  • BMFont in sprite collection serialized properly - the intermittent issue where the font was getting garbled should be fixed
  • Sprite dicing filtering massively improved
  • Fixed Tilemap "prefab losing data" bug when tilemap is in a committed state and sprite collection is changed.
  • Sliced/Tiled/Sliced sprites will not reset colliders when Create Box Collider is unticked. You can now define your own colliders this way.
  • Warning when incompatible mesh type is used with sliced / tiled / clipped sprite.
  • Layer active state remembered when rebuilding.
  • Mesh normals/tangents on tiled, sliced and clipped sprites
  • Tilemap prefab will now automatically build when Instantiated or dragged into the scene.
  • TileMap TMX import now works with staggered tilemaps
  • tk2dUIManager warns when there are children - the children will not be deleted when switching scenes.
  • tk2dUIManager works better with legacy config and scene switching
  • When a tk2dUIManager already exists, a duplicate will be deleted - the gameobject remains, in case the user has other components on it.
  • Separated tilemap code from core tk2dUI codebase - you can now once more remove UI and Tilemap directories and simply use core tk2d.
  • tk2dUITouch - fingerId was assigning to self
  • Reuploaded the build - there was a tiny typo in 1 - UI demo. No need to update unless absolutely necessary.
  • When a duplicate sprite is dropped in the sprite collection editor, ask what to do. Allows you to drop a folder and just add the new sprites.
  • Scrollbar distance bugfix
  • Playmaker PlayAnimation action fixed
  • Windows phone 8 rotation matrix
  • Default sprite collection size is now 2048. 1024 is no longer a sensible minimum. No one targets iPhone3G anymore, right?
  • tk2dTextMesh - GetEstimatedBounds will return a Bounds that should match the mesh bounds.
  • Fixed a few missing SetDirtys that were causing issues in Unity 4.x
  • Screen extents change every frame
  • Warn when text.Length > maxChars
  • UILayout happens in world space rather than local - works with localScale
  • Scrollable area demo now has a sample using layout
  • Clicking the middle of the anchor box will anchor to all sides
  • tk2dCamera fov fixed
  • Custom sprite geometry trimming bugfix
  • Platform specific attach points fixed

n3rdloop

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 47
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #1 on: October 13, 2013, 10:42:07 am »
Thanks for this update Unikron.

Can we know what benefits we would get from the new dicing algorithm? Is there any performance gains? Lesser atlas sizes?

I'm just wondering if its worth updating the release we have on store, just for the new dicing.

Thanks,

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #2 on: October 13, 2013, 11:19:53 am »
It improves the edge filtering, and adds the option for splitting off solid and transparent tiles as shown in the tutorial. If you have large predominantly solid images, you could potentially get huge perf gains with a little bit of work.

The improved edge filtering makes diced images upscale a lot better, and downscaling works better if you don't have Mipmaps. You will need to recommit your sprite collection after updating - the algorithm change happens in the atlas builder.

PixelCrucible

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #3 on: October 13, 2013, 04:55:44 pm »
Hey, the new features are great, but I have a small question.

How do you set the size of a "Layout" object, other than using the handles in the editor?
Can you programmatically set it? I'd like to have it resize to the current screen resolution.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #4 on: October 13, 2013, 05:53:35 pm »
Check UI Demo #2 - there is an example of resizing layouts programatically.

iamagiantnerd

  • Guest
Re: 2D Toolkit 2.2.2
« Reply #5 on: October 13, 2013, 09:17:41 pm »
Having some trouble with a tilemap with this update. I'm getting this error:

Code: [Select]
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[tk2dRuntime.TileMap.Layer,System.Boolean].get_Item (tk2dRuntime.TileMap.Layer key) (at /Applications/buildAgent/work/c514da0c8183631c/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
tk2dRuntime.TileMap.BuilderUtil.CreateRenderData (.tk2dTileMap tileMap, Boolean editMode, System.Collections.Generic.Dictionary`2 layersActive) (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMapBuilderUtil.cs:318)
tk2dTileMap.Build (BuildFlags buildFlags) (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMap.cs:277)
tk2dTileMap.Build () (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMap.cs:177)

I'm building the tilemap programmatically.  This all worked fine with 2.2.1, and I haven't done anything other than upgrade to 2.2.2.  Not sure what other information I can provide for this.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #6 on: October 13, 2013, 10:42:42 pm »
That looks like the render data is somehow missing. Can you provide any more background info about what you're doing in surrounding code?

iamagiantnerd

  • Guest
Re: 2D Toolkit 2.2.2
« Reply #7 on: October 14, 2013, 11:57:20 pm »
The tile map is programmatically generated. When a new map was loaded, I was destroying the render data and re-creating it before setting the tiles in the different layers.  Maybe something is has changed in the way I should do this. Basically, I was doing the following:

Code: [Select]
// map is tk2dTileMap
DestroyImmediate(map.renderData);
map.renderData = null;
map.Layers = null;
tk2dRuntime.TileMap.BuilderUtil.InitDataStore(map);

// loop though the map and create the tiles
..looping code...
map.Layers[0].SetTile(x,y,tile);
map.Layers[1].SetTile(x,y,tile2);
map.Layers[2].SetTile(x,y,tile3);
map.Layers[3].SetTile(x,y,tile4);
..end loop

map.Build();


When I don't destroy the render data and re-create it, I get pre-fabs left over from the previous map.

Basically, I need to reset the map to be "empty" again, including prefabs, and then re-populate it.  Maybe there's a better/different way to accomplish this.

PixelCrucible

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #8 on: October 17, 2013, 01:26:40 am »
Hey, just a heads up, there's missing documentation for the tk2dUILayout class. Some of those function parameters are not so clear.

http://www.unikronsoftware.com/2dtoolkit/doc/2.2/html/classtk2d_u_i_layout.html

Also, resizing (programmatically) the Layout does not take rotation into account.

« Last Edit: October 17, 2013, 01:28:20 am by PixelCrucible »

Kirb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #9 on: October 17, 2013, 04:35:27 am »
I am also getting a similar error:

Quote
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[tk2dRuntime.TileMap.Layer,System.Boolean].get_Item (tk2dRuntime.TileMap.Layer key) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
tk2dRuntime.TileMap.BuilderUtil.CreateRenderData (.tk2dTileMap tileMap, Boolean editMode, System.Collections.Generic.Dictionary`2 layersActive) (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMapBuilderUtil.cs:317)
tk2dTileMap.Build (BuildFlags buildFlags) (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMap.cs:276)
tk2dTileMap.EndEditMode () (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMap.cs:486)
tk2dTileMap.Awake () (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMap.cs:121)
UnityEditor.DockArea:OnGUI()

There's no code going on with it; just straight up vanilla 2DTK tilemaps.

Usually the error is accompanied by a jumbled tilemap. If I find the correct tilemap in the scene and recommit, it will seemingly fix itself. It also appears to be the same exact sprite map, the same collection; other collections are not affected. Not entirely sure, but I believe the error began happening at or around when I added an additional layer to the tilemap in question...
« Last Edit: October 17, 2013, 04:47:01 am by Kirb »

x8105

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 85
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #10 on: October 17, 2013, 06:08:05 am »
tk2dUICamera issues... Cannot click a button viewed by a perspective camera with a tk2dUICamera script on it,  When an ortho camera has a tk2dUIcamera on it.

Unity 4.2.2f1
working before tk2d 2.2.2 final, Any thoughts? my brain hurts from this. tried the 3dui demo in a fresh load.
« Last Edit: October 17, 2013, 02:49:18 pm by x8105 »

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #11 on: October 17, 2013, 03:54:28 pm »
The new dicing stuff looks great - I am unable to check myself right now, but does this work with sprite sheets? So if we create a new sprite sheet, and point it to a PSD that has large sprites?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #12 on: October 17, 2013, 03:57:18 pm »
There is no reason it shouldnt, but you will likely be limited by the max size of your sprite sheet... Unity doesn't play too well with having many large images loaded in - your spritesheets will need to be really big to get meaningful gains by dicing inidvidiaul imported sprites from the sprite sheet...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #13 on: October 17, 2013, 04:01:29 pm »
I am also getting a similar error:

Quote
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[tk2dRuntime.TileMap.Layer,System.Boolean].get_Item (tk2dRuntime.TileMap.Layer key) (at /Applications/buildAgent/work/84669f285f6a667f/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
tk2dRuntime.TileMap.BuilderUtil.CreateRenderData (.tk2dTileMap tileMap, Boolean editMode, System.Collections.Generic.Dictionary`2 layersActive) (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMapBuilderUtil.cs:317)
tk2dTileMap.Build (BuildFlags buildFlags) (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMap.cs:276)
tk2dTileMap.EndEditMode () (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMap.cs:486)
tk2dTileMap.Awake () (at Assets/TK2DROOT/tk2d/Code/TileMap/tk2dTileMap.cs:121)
UnityEditor.DockArea:OnGUI()

There's no code going on with it; just straight up vanilla 2DTK tilemaps.

Usually the error is accompanied by a jumbled tilemap. If I find the correct tilemap in the scene and recommit, it will seemingly fix itself. It also appears to be the same exact sprite map, the same collection; other collections are not affected. Not entirely sure, but I believe the error began happening at or around when I added an additional layer to the tilemap in question...

This is a bug relating to layers. I'll be releasing a patch for this soon - email support if you need it sooner.

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: 2D Toolkit 2.2.2
« Reply #14 on: October 17, 2013, 04:05:10 pm »
There is no reason it shouldnt, but you will likely be limited by the max size of your sprite sheet... Unity doesn't play too well with having many large images loaded in - your spritesheets will need to be really big to get meaningful gains by dicing inidvidiaul imported sprites from the sprite sheet...

Yea..I guess it really isn't even needed anyway, since the sprite sheet is diced anyway and you can select which tiles to be solid/transparent manually.