2D Toolkit Forum

2D Toolkit => Releases => Topic started by: unikronsoftware on October 12, 2013, 02:01:32 pm

Title: 2D Toolkit 2.2.2
Post by: unikronsoftware 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

Bug fixes and improvements
Title: Re: 2D Toolkit 2.2.2
Post by: n3rdloop 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,
Title: Re: 2D Toolkit 2.2.2
Post by: unikronsoftware 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.
Title: Re: 2D Toolkit 2.2.2
Post by: PixelCrucible 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.
Title: Re: 2D Toolkit 2.2.2
Post by: unikronsoftware on October 13, 2013, 05:53:35 pm
Check UI Demo #2 - there is an example of resizing layouts programatically.
Title: Re: 2D Toolkit 2.2.2
Post by: iamagiantnerd 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.
Title: Re: 2D Toolkit 2.2.2
Post by: unikronsoftware 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?
Title: Re: 2D Toolkit 2.2.2
Post by: iamagiantnerd 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.
Title: Re: 2D Toolkit 2.2.2
Post by: PixelCrucible 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.

Title: Re: 2D Toolkit 2.2.2
Post by: Kirb 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...
Title: Re: 2D Toolkit 2.2.2
Post by: x8105 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.
Title: Re: 2D Toolkit 2.2.2
Post by: fsadeq 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?
Title: Re: 2D Toolkit 2.2.2
Post by: unikronsoftware 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...
Title: Re: 2D Toolkit 2.2.2
Post by: unikronsoftware 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.
Title: Re: 2D Toolkit 2.2.2
Post by: fsadeq 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.
Title: Re: 2D Toolkit 2.2.2
Post by: unikronsoftware on October 17, 2013, 05:21:38 pm
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.

That is an embarrassingly bad typo bug :( I apologise for the inconvenience, I should have spotted it sooner. I will upload a patch (2.2.3) for this tomorrow.
To patch it in right now:

tk2dUIManager (line 655 or thereabouts), replace:
Code: [Select]
            tk2dUICamera currCamera = sortedCameras[0];
with
Code: [Select]
            tk2dUICamera currCamera = sortedCameras[i];

EDIT: 2.2.3 is out now
Title: Re: 2D Toolkit 2.2.2
Post by: iamagiantnerd on October 19, 2013, 05:07:25 am
This is all fixed now with 2.2.3! Thanks for the quick response!

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.