2D Toolkit Forum

2D Toolkit => Releases => Topic started by: unikronsoftware on August 03, 2013, 08:57:33 pm

Title: 2D Toolkit 2.1 final + hotfix 1
Post by: unikronsoftware 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

Bug fixes and improvements

Known issues
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: CliffCawley 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.
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: unikronsoftware 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.
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: CliffCawley 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 :)
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: CoderBear 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?
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: unikronsoftware 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.
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: CliffCawley 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?
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: unikronsoftware on August 14, 2013, 11:26:38 am
use OnClickUIItem instead of OnClick. That passes the parameter
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: CliffCawley on August 14, 2013, 11:46:56 am
Oh right, of course!  :-[

Thanks :)
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: Mixu 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?
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: unikronsoftware 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
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: korn3l on September 03, 2013, 04:20:38 pm
Why is there a Color and SolidColor Clear Flag?
Title: Re: 2D Toolkit 2.1 final + hotfix 1
Post by: unikronsoftware 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.