Hello Guest

Author Topic: 2D Toolkit 1.91 beta 1  (Read 6730 times)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9673
    • View Profile
2D Toolkit 1.91 beta 1
« on: February 10, 2013, 11:43:24 PM »
As with all beta releases, exercise caution when upgrading. Make sure you have a back up!

Features:
- Brand new sprite picker with preview and filtering, see attached screenshot.
- tk2dCamera supports "inherit settings". This will let you hook up a tk2dCamera prefab, set up the resolution overrides and such on it, and just inherit the settings onto a tk2dCamera in a scene. It is also useful in another scenario,
- tk2dCamera supports clipping. This is an early no-frills implementation, but it works. Notes below.

Bugfixes and improvements:
- Sprite collection editor warns when sprites are missing, and won't allow builds with missing sprites to avoid damaging already built data.
- Fixed clear references in sprite collection editor
- Rebuilt built-in fonts, some were in an ancient format and had never been updated.
- Force texture size is now used properly with platform specific collections
- sprite.collection made private, this was an internal variable which was accidentally left public. Use .Collection instead if you need to read the value, and prefer new SetSprite APIs for setting a new sprite.
- sprite.SetSprite, a unified way to set sprites. SetSprite( spriteId), SetSprite( spriteName ), SetSprite( collection, spriteId), SetSprite( collection, spriteName)
- tk2dGrid, started using in some places
- tidied up preferences system (all current preferences will be lost)

tk2dCamera clipping notes

- Tk2dCamera now supports viewport clipping. This is only allowed on a second camera, so don't forget to set the "Depth" parameter to something greater than your primary camera, and set clear flags to "Depth only" or "Dont clear" depending on what you want. Also, use layers to mask information from one scene to another.
- The cost of the clipping is close to zero (especially so if you don't clear on the second camera), and you can clip anything. As a downside, you can't rotate the clip region, it must be rectangular and in screen space.
- If you have 2 tk2dCameras in the scene, you can (and probably should) use "Inherit settings" so you won't have to set up the overrides twice and make sure they're the same.
- The clipping behaves very differently to the built in Unity camera "viewport rect", and has different terminology (region instead of rect).
- The region is like a clip region, it reveals part of the background. Set up the region to 0, 0, 100, 100, and then slide the X value. This will let you really easily set up a level selector visually. Just set it up as though you're drawing everything and set up the the viewport clipping region on the second camera.
- You can anchor within clipped regions
- More features will be coming, like anchoring the clip region dimensions.

Amon

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
  • Everything is made of the same thing! Energy!
    • View Profile
    • Amon.co
Re: 2D Toolkit 1.91 beta 1
« Reply #1 on: February 10, 2013, 11:49:26 PM »
Thanks! Will test now.
http://www.amon.co - Amon Interactive Ltd | Dev Tools - Unity 4 Pro - 2D Toolkit - RealStudio 2012 r2 - Monkey - Modo 601 SP4 - Photoshop CS6 - 3D Coat - My Brain!

mfcas

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: 2D Toolkit 1.91 beta 1
« Reply #2 on: February 11, 2013, 10:42:45 AM »
This is much better.

I've got one request:
Would it be possible to drag the frames that I am interested in directly from the project view and then setup them in the way I want in the animation editor? I assume the system knows which texture is assigned to which sprite, so by dragging  the texture it would be possible to insert appropiate sprites into the sprite animation.

What do you think?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9673
    • View Profile
Re: 2D Toolkit 1.91 beta 1
« Reply #3 on: February 11, 2013, 11:01:10 AM »
The reasons I've not done that:

1. Textures might not exist in the project - you could build the sprite collection in another project, and just import that into the current one. Useful to save memory / reduce number of files.

2. A texture might be extracted from a source, eg. spritesheet, so 1 texture could contain more than 1 sprite.

3. It is often required to have the same texture in multiple collections in a large project, to balance draw calls. Its easy to mistakenly pick the sprite collection in this kind of situation, and inadvertently create an issue which will be hard to track down later... I have done this a few times, and spent AGES tracking down a spike in performance.

4. Textures might not exist in any project - support for importing atlases from TexturePacker is coming in a future update.

If you'd like to add it, I will happily point you in the right direction, its pretty straightforward, but as mentioned above there are downsides to it...

mfcas

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: 2D Toolkit 1.91 beta 1
« Reply #4 on: February 11, 2013, 12:42:01 PM »
I should be OK with the new picker + autofill. Thanks for the explanation.

dakeese

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: 2D Toolkit 1.91 beta 1
« Reply #5 on: February 12, 2013, 02:00:01 AM »
Here's some feedback.

I like the new features!

I'm missing the shortcut "Edit..." button in the tk2dSprite inspector window that takes you to the sprite collection.  When I have multiple sprite collections, it gets convoluted to try to find the right collection in the Project view and make little tweaks to a sprite.  That shortcut was very helpful.

In the Collection editor, under Texture Settings, it seems to me like the "User defined" checkbox is reversed. 

Also in the Texture Settings, I'm still unclear on what I should do with it if I just want to use my own shader for custom effects and be sure it won't get overridden.

Thanks!

EDIT: or is it as simple as just finding the material in the Project view, and then choosing a different shader in the inspector's drop down?

Did you put an explanation somewhere of how to use the Platform settings? Should I set Current Platform to the biggest one I want to support (4x for iPad3/4)? And then what do I do with Unity's quality settings?  I think I might want to just ignore this and use Unity's Quality settings and trilinear filtering so I can support a wide range of Androids as well.
« Last Edit: February 12, 2013, 02:06:29 AM by dakeese »

hemdanw

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: 2D Toolkit 1.91 beta 1
« Reply #6 on: February 12, 2013, 01:22:21 PM »
Hi,

I ran into one incompatibility issue with v1.91 beta, but was easily fixable. Everything else worked well.

I'm assuming that now I need to go through the script component to get to the collection data (which I tested and works with 1.91 beta - but not sure if you were planning to deprecate that too, seems that the deprecation warning is only for "set", not "get")?

I need a "collection" to use with SwitchCollectionAndSprite(), example:
mySprite.SwitchCollectionAndSprite(mySprite.collection, id2);   

Thanks,
   hemdanw

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9673
    • View Profile
Re: 2D Toolkit 1.91 beta 1
« Reply #7 on: February 12, 2013, 01:42:21 PM »
@hemdanw - so, did you just change the code to:
mySprite.SwitchCollectionAndSprite(mySprite.Collection, id2);   

That would be identical to previous behaviour.
This unfortunately (getting rid of .collection) had to be broken, as setting .collection causes serious amounts of grief.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9673
    • View Profile
Re: 2D Toolkit 1.91 beta 1
« Reply #8 on: February 12, 2013, 01:47:57 PM »
Here's some feedback.

I like the new features!

I'm missing the shortcut "Edit..." button in the tk2dSprite inspector window that takes you to the sprite collection.  When I have multiple sprite collections, it gets convoluted to try to find the right collection in the Project view and make little tweaks to a sprite.  That shortcut was very helpful.

In the Collection editor, under Texture Settings, it seems to me like the "User defined" checkbox is reversed. 

Also in the Texture Settings, I'm still unclear on what I should do with it if I just want to use my own shader for custom effects and be sure it won't get overridden.

Thanks!

EDIT: or is it as simple as just finding the material in the Project view, and then choosing a different shader in the inspector's drop down?

Did you put an explanation somewhere of how to use the Platform settings? Should I set Current Platform to the biggest one I want to support (4x for iPad3/4)? And then what do I do with Unity's quality settings?  I think I might want to just ignore this and use Unity's Quality settings and trilinear filtering so I can support a wide range of Androids as well.

The "edit" button too, but it was taking up valuable space. Thankfully, I miss it too sometimes, so its not gone away completely - go into 2D Toolkit > Preferences and tick "Display Edit Button". Done :) Maybe I'll replace it with a tiny unity "ping" object, so you can select the collection & sprite separately in a later version.

Collider type - User defined is correct, it means it won't mess about with what you set up on the sprite instance, i.e. you can set up your own collider, and tk2d won't interfere. If you set it to None, it will make sure there is no collider attached when you switch to that sprite.

Docs for multiple materials - http://unikronsoftware.com/2dtoolkit/doc/tutorial/multiple_materials_in_a_sprite_collection.html

Docs for platform settings - http://unikronsoftware.com/2dtoolkit/doc/advanced/platform_specific_sprite_collections.html