Hello Guest

Author Topic: 2D Toolkit 2.1 final + hotfix 1  (Read 23247 times)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
2D Toolkit 2.1 final + hotfix 1
« on: August 03, 2013, 08:57:33 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.10/migration_guide.html

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


Check out our Whack-a-mole tutorial:
http://unikronsoftware.com/2dtoolkit/doc/2.10/tutorial/whack_a_mole/index.html


What's new
  • Documentation has been updated for 2.1 and the first part of the whack-a-mole tutorial has now been published.
  • UI Item sendmessage call wrapped - you can now select methods from a dropdown instead of typing them out. A default parameter is also sent.
  • Tilemap demo added.
  • Attach point demo added.
  • Tilemap editor - Flipped tile support.
  • Tilemap editor - Unlimited scratchpad to store templates / custom tile layouts.
  • Tilemap editor - Tile paint mode massively improved with new UI, vertex color paint supports individual channels.
  • Tilemap editor - Instanced prefabs are saved. You can change properties on them and they will be remembered.
  • Tilemap editor - Physics material can be set up per tilemap layer.
  • Attach points - You can now set up attach points directly on the sprites. You can attach other sprites to these attach points, or simply use them as markers in your code. When set up on a frames of animation, these will be animated together with the frames.
  • Sprite collection builder - duplicate textures are now removed, textures are compared by a contents hash.
  • Sprite collection global texture rescale.
  • tk2dCamera v3 - now much better than before. Preview of native resolution, preview resolution in viewport.
  • tk2dCamera v3 - Uses game view resolution/aspectratio as "preview resolution" when present, no need to enter resolutions twice.
  • tk2dCamera v3 - Zoom Factor (replacing zoom scale), works with or without overrides
  • tk2dCamera v3 - Size set up as "ortho size" or "pixels per meter". Default legacy size, Pixels per meter = 1
  • tk2dCamera v3 - Works on perspective camera as well, allowing for 1:1 to be exact at any resolution
  • tk2dCamera v3 - hides the Unity camera implemnentation to avoid confusion
  • tk2dCamera v3 - supports multiple cameras with different sizes in scene, uses unity layers to VERY quickly detect the right camera for a sprite / object.
  • tk2dCamera v3 - Override UI revamped.
  • tk2dCameraAnchor - Works with any camera type, including perspective.
  • Sprite collection / font editor - will automatically detect camera settings if a tk2dCamera is found in the scene, less room for error. Set up exactly the same as a tk2dCamera.
  • Static sprite batcher - option to sort by camera, allows correct sorting when not viewed straight along z axis.
  • PlayMaker actions included - unpack from tk2d/Goodies/PlayMaker Actions

Bug fixes and improvements
  • tk2dCamera - added missing obselete zoomScale setter
  • tk2dCamera - fixed viewport clipping when origin set to center, was working fine at bottom left
  • tk2dCamera - added "ScaledResolution" back in, marked as obsolete.
  • tk2dButton (legacy) - fixed for Unity 4.2
  • tk2dCamera - fixed for Unity 4.2
  • tk2dUIScrollableArea - swipe cancelled properly when Disabled.
  • tk2dCamera - anchored viewport clipping fixed, wasn't possible to re-enable.
  • Polygon editor, deselect vertex after performing any major operations, deleting, flipping, etc.
  • Updated tk2dCamera script docs
  • Tilemap editor - more undo fixes. Should've got everything now. When entering edit mode, chunk gameobjects are created for all chunks. This is not a bug, and required for undo to work properly. Unnecessary ones are deleted when committed.
  • Tilemap editor - vertical scroll wheel works when mouse is over tilemap palette.
  • Tilemap editor - Creation stage made far more sensible, and replaced sprite collection picker.
  • tk2dCamera - default far clip plane = 50.
  • tk2d update checker window - warn when in webplayer.
  • Sprite collection editor - copy geometry islands correctly.
  • Removed beta tag from tilemap editor.
  • Word wrap correctly considers spacing.
  • Convert to ui sprite animator moved to UI code, dependency in core tk2d removed.
  • Tilemap colliders built properly, even if not committed.
  • Tilemap editor - fixed a lot of cases where modified prefab data could be lost.
  • Tilemap editor - fixed undo which failed in some situations leaving orphaned chunks of data.
  • Tilemap editor - Prefabs can be spawned at runtime using SetTile.
  • tk2dCamera - removed half pixel offset from camera anchors on Windows/D3D.
  • tk2dCamera - Patched for missing screenResolution / ScreenOffset functions, marked as Obsolete.
  • tk2dCamera - Fixed rogue memory allocation at runtime.
  • Packed fonts fixed.
  • Text mesh inline styling bugfix when used from code.
  • Sprite selector bugfix.
  • UI scrollablearea fixed to work the same regardless of resolution.
  • UI scrollablearea - OnScroll is now triggered when expected.
  • UI scrollablearea - MeasureContentLength, for when you just want to fit the content you've dynamically created at runtime.
  • Diced texture parameters are shown in the editor - easier to make decisions on dice size.
  • Font - cope with invalid characters.
  • Tilemap - bugfix with color interpolation at boundaries.
  • Sprites - Scene widget works at any axis.
  • UI demo - old sans font replaced.
  • And many many more bugfixes - Let us know if a bug you reported isn't fixed.

Known issues
  • Windows Phone 8 - static sprite batcher not working properly when committed. Keep it uncommitted for now while we fix this.
  • tk2dCamera - when using a tk2dCamera, the scene is marked dirty (needs saving) constantly. This will be fixed in a future release
« Last Edit: August 05, 2013, 10:24:50 pm by unikronsoftware »

CliffCawley

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #1 on: August 05, 2013, 01:44:45 am »
This was reported in the 2.1 final, but when adding a tk2dCamera to the scene it forces the scene to always be dirty.

I.e. If I add a tk2dCamera to an empty scene and save it, it'll immediately be dirty again and require re-saving. (An * is added to the Unity Titlebar and opening another scene prompts me to save the scene with the tk2dCamera in it).

I think this is because the tk2dCamera is always updating the Unity Camera with it's own settings and therefore dirtying the Unity Camera's settings? Although I'm not 100% sure about this because if I remove the Camera component and just have a tk2dCamera on an object, I get the same effect.

I know you mentioned you'll fix this for the next release, so I guess I'm just putting my vote in for this to be fixed as well.
« Last Edit: August 05, 2013, 01:48:57 am by CliffCawley »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #2 on: August 05, 2013, 10:22:10 pm »
Its mainly the data it mirrors to the UnityCamera.
The main problem is that there is no way to detect if a Unity camera is using a custom matrix - the only way is to call ResetProjectionMatrix. Which is terrible, as if it isn't called at the right time, the whole thing will behave pretty weirdly. Also, some Unity getters allocate memory (yay), and it seemed to be the lesser of two evils prompting a save all the time vs constantly allocating memory.
Any "fix" will need to be thoroughly tested to avoid weird situations - I'll try to do it for the next release.

CliffCawley

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #3 on: August 06, 2013, 09:50:28 am »
Its mainly the data it mirrors to the UnityCamera.
The main problem is that there is no way to detect if a Unity camera is using a custom matrix - the only way is to call ResetProjectionMatrix. Which is terrible, as if it isn't called at the right time, the whole thing will behave pretty weirdly. Also, some Unity getters allocate memory (yay), and it seemed to be the lesser of two evils prompting a save all the time vs constantly allocating memory.
Any "fix" will need to be thoroughly tested to avoid weird situations - I'll try to do it for the next release.

Great, thanks for letting me know :)

CoderBear

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #4 on: August 13, 2013, 07:41:44 pm »
You had fixed this in 1.92, isn't there a way to fix this in 2.1 since the issue has reappeared?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #5 on: August 13, 2013, 07:53:10 pm »
Its a slightly different issue in 2.1, in 1.92 it was naively doing some things. Here it actually does need to do some of those things. I'm trying something out for 2.2 which seems to work so far.

CliffCawley

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #6 on: August 14, 2013, 11:17:33 am »
How can I get the button that was clicked from the OnClick event for a tk2dUIItem?

The docs at: http://unikronsoftware.com/2dtoolkit/doc/2.10/ui/system.html say that the event takes a param of the control instance that sent it, but when I look at the declaration of the event, it's only a System.Action, which has no params.

If I try to use the example code from the above documentation link, then I just get:

error CS0123: A method or delegate `Clicked(tk2dUIItem)' parameters do not match delegate `System.Action()' parameters

Have I missed something?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #7 on: August 14, 2013, 11:26:38 am »
use OnClickUIItem instead of OnClick. That passes the parameter

CliffCawley

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #8 on: August 14, 2013, 11:46:56 am »
Oh right, of course!  :-[

Thanks :)

Mixu

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #9 on: September 03, 2013, 12:06:41 pm »
Hi! I just updated to the Asset Store version (this one) and found some compilation failures related to tk2dCamera:

Code: [Select]

Assets/Plugins/tk2d/Code/Camera/tk2dCamera.cs(18,34): error CS0246: The type or namespace name `tk2dCameraSettings' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Camera/tk2dCamera.cs(33,16): error CS0246: The type or namespace name `tk2dCameraResolutionOverride' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Camera/tk2dCamera.cs(40,16): error CS0246: The type or namespace name `tk2dCameraResolutionOverride' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Fonts/tk2dFont.cs(24,16): error CS0246: The type or namespace name `tk2dSpriteCollectionSize' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Sprites/tk2dBaseSprite.cs(645,72): error CS0246: The type or namespace name `tk2dSpriteCollectionSize' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Sprites/tk2dSprite.cs(127,69): error CS0246: The type or namespace name `tk2dSpriteCollectionSize' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Sprites/tk2dRuntimeSpriteCollection.cs(10,91): error CS0246: The type or namespace name `tk2dSpriteCollectionSize' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Sprites/tk2dSpriteCollection.cs(541,16): error CS0246: The type or namespace name `tk2dSpriteCollectionSize' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Sprites/tk2dSpriteCollectionData.cs(515,83): error CS0246: The type or namespace name `tk2dSpriteCollectionSize' could not be found. Are you missing a using directive or an assembly reference?
Assets/Plugins/tk2d/Code/Sprites/tk2dSpriteFromTexture.cs(9,16): error CS0246: The type or namespace name `tk2dSpriteCollectionSize' could not be found. Are you missing a using directive or an assembly reference?

(and some more on different lines)


It seems the access to tk2dCameraUtil.cs is not done in the using section.

Any tip on fixing this?
Thanks!

EDIT: nevermind, I just deleted the TK2DROOT directory, and imported again... and worked.

Another question, when using a tk2dUIItem for sending a message, listed are the available functions that don't have any parameter, but... what should I do if I want to pass a parameter?
« Last Edit: September 03, 2013, 12:18:35 pm by Mixu »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #10 on: September 03, 2013, 01:06:57 pm »
tk2d 2.2 changes things slightly - you get a lot more events to add functions to, and it also supports parameters. The optional parameter type is shown on the event.

For the basic down/up events, it takes an empty function, or one with a tk2dUIItem parameter

korn3l

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #11 on: September 03, 2013, 04:20:38 pm »
Why is there a Color and SolidColor Clear Flag?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 2.1 final + hotfix 1
« Reply #12 on: September 03, 2013, 06:23:24 pm »
They're both the same thing. Its using the Unity built in serialized property, and for some unknown reason it shows both properties in Unity 4.x. Its harmless.