Hello Guest

Author Topic: 2D Toolkit 1.80 Alpha 3  (Read 19414 times)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
2D Toolkit 1.80 Alpha 3
« on: September 29, 2012, 02:36:15 am »
THIS IS AN UNSTABLE ALPHA RELEASE.
PLEASE DO NOT DOWNLOAD UNLESS YOU WANT TO HELP TEST.


The oft delayed, ever elusive 1.80 now does what it needs to, and we need YOUR help to test and help minimise the amount of broken features before general release. As the big red sign says, treat this as alpha quality, and please don't install this over your project without backing up. Not all branches are merged in at this point, so don't be disappointed if a feature I promised isn't in (feel free to remind me, though, in case I've forgotten).

A significant amount of code has changed, and we need to make sure everything works.

How to help test
1. Backup your project
1. Import unity package
2. Use as normal, and please report any broken features. You are very likely to find broken features. I've found at least one broken feature in every one of our projects.

Please don't base your project off this - a few variable names are still due to change, and will undoubtedly break your project.

Features and changelist
Unity 3.5 and above only
Renamed collider types (ForceNone instead of None, UserDefined instead of Unset). Makes a lot more sense.
All mesh leaks plugged, hopefully.
Sprite collection settings page tidied up, added a lot more texture options.
Massive memory saving with large animations (there was a constant overhead, which is now fixed).
New tk2dSystem feature, manages platforms and resources.
Sprite collection can be made loadable - this uses the tk2dSystem resource loading feature, and doesn't need files moved to different locations. The sprite collection can also be loaded by GUID at runtime.
Sprite collections are sorted by name in inspector
Internal data upgrade, slowly moving away from legacy cruft (hopefully still backwards compatible). A message is printed out when sprite collections are upgraded.
Animated sprite bugfix, calling play from an event works.
Runtime sprite collection stuff integrated, use tk2dSprite.CreateFromTexture or tk2dSpriteCollectionData.CreateFromTexture
Switch platfroms in editor in the preferences page. Sprite collections and fonts which have platform data will switch when this is changed.
Sprite collections don't use mipmaps by default.
And loads more small fixes

Limits, bugs and incomplete features
Platforms are limited to 1x and 2x for now. This can be fully customised, but no interface exists right now.
Can't override textures / fonts on other platforms. Is this necessary?
Tilemaps won't work properly with platform specific sprite collections.
Material overrides won't work with platform specific sprite collections.
Auto atlas building is broken (but will be fixed in the next alpha. This broke very recently so I just need to work out what change broke it)
tk2dSystem.CurrentPlatform needs to be set at runtime before loading anything in

How to create platform specific sprite collections
1. Create your sprite collection as usual. It is usually best to start off with SD textures, as if you start off with HD textures and your texture has an odd number of pixels, the SD sprite won't be aligned correctly, esp when center aligned.
2. Open settings page in sprite collection editor.
3. Click on "Add platform support". This will create the system object and the directory structure necessary. You will only need to do this once ever. This creates a Resources/tk2d directory and Resources/tk2d/tk2dSystem. This should be checked in to version control.
4. Set the "Current platform" of the sprite collection you're working on.
5. Click on "Add new platform" and select the other platform on there.
6. Commit (and wait a little bit longer than usual).

That's it.
The system will look for alternate textures and fonts by using the rules below:
1. @platform appended to filename. Eg. bighappysprite1.png -> bighappysprite1@2x.png. It will also match bighappysprite1@1x.png -> bighappysprite1@2x.png.
2. A subdirectory called platform. bighappysprite1.png -> 2x/bighappysprite1.png
3. @platform in subdirectory. bighappysprite1.png -> 2x/bighappysprite1@2x.png
The system will also cope with different extensions, but preference is given to the same extension if multiple files are found.


The main thing here is to make sure existing projects continue to work properly, and I will be sorting these out as a matter of priority. Thanks for your help!

Izitmee

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
    • Holoville Games
Re: 2D Toolkit 1.80 Alpha 3
« Reply #1 on: September 29, 2012, 10:09:30 am »
Awesome news :)

I tried it on a recent small game I'm working on, which only contains regular Sprites, SlicedSprites, and TextMeshes, and has a single SpriteCollection.
When I updated the package (not sure if the previous one was v1.7final_patch2 or v1.76final_patch3 - how can we check the installed 2D Toolkit version?), I got a bunch of warnings but then everything worked ok, both in the editor and in runtime.
Problems arose when I tried to add Platforms. I added both a 1x and a 2x, keeping 1x as Current Platform. As soon as I pressed Commit, I got a bunch of these errors: "Unable to find platform specific texture '[MyTextureName]' for platform '2x'", which are all about 2x versions, and none about 1x. After that, when I select any sprite in the Hierarchy, I get this repeating error (coming from the Inspector's GUI):

IndexOutOfRangeException: Array index is out of range.
tk2dSpriteThumbnailCache.GetThumbnailTexture (.tk2dSpriteCollectionData gen, Int32 spriteId) (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteThumbnailCache.cs:46)
tk2dSpriteEditor.DrawSpriteEditorGUI (.tk2dBaseSprite sprite) (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteEditor.cs:62)
tk2dSpriteEditor.OnInspectorGUI () (at Assets/TK2DROOT/tk2d/Editor/Sprites/tk2dSpriteEditor.cs:11)
UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty) (at C:/BuildAgent/work/d9c061b1c154f5ae/Editor/Mono/Inspector/InspectorWindow.cs:888)
UnityEditor.InspectorWindow.OnGUI () (at C:/BuildAgent/work/d9c061b1c154f5ae/Editor/Mono/Inspector/InspectorWindow.cs:243)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)

EDIT: though reading again about Platforms, I suppose I misunderstood how they have to be used, so it's not a bug?
« Last Edit: September 29, 2012, 10:11:20 am by Izitmee »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #2 on: September 29, 2012, 10:20:42 am »
It probably isn't a bug - it implies that you're missing 2x textures. The matching is automatic, so you will need corresponding @2x textures, or a 2x directory as described in the rules above.

I'll make a tutorial on this once everything is ironed out.

I'm really pleased that you didn't have any issues before this though, that was what I was most worried about, that I could have accidentally broken other features.

Izitmee

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 99
    • View Profile
    • Holoville Games
Re: 2D Toolkit 1.80 Alpha 3
« Reply #3 on: September 29, 2012, 10:24:09 am »
Yes, I definitely am missing 2x textures. Sorry for having completely misunderstood how that worked :P

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #4 on: September 29, 2012, 05:35:55 pm »
I'm going to start testing this out soon. Question though, do you think you can add resolution presets for iPhone 5?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #5 on: September 29, 2012, 06:54:19 pm »
Absolutely. I've got a prototype system which is pretty flexible - in most cases you don't want a brand new atlas for iPhone5 - only backgrounds and things like those need a unique atlas, and you'll be able to match iphone5 first and then 2x - if a sprite collection has an iphone5 specific atlas it'll match that over 2x, but if that doesn't exist it'll fall back to 2x.

I'll start merging more branches once I've established this hasn't broken any core features.

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #6 on: October 02, 2012, 03:34:58 am »
Getting this bug, not sure why or if it is related to 1.80:

Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
tk2dSprite.UpdateVerticesImpl () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSprite.cs:142)
tk2dSprite.UpdateVertices () (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSprite.cs:125)
tk2dBaseSprite.set_scale (Vector3 value) (at Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs:76)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #7 on: October 02, 2012, 04:51:09 pm »
Possibly, what is the context of this? When does it happen?

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #8 on: October 02, 2012, 06:23:04 pm »
As soon as I run the scene.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #9 on: October 02, 2012, 06:40:00 pm »
It looks like at least one step is missing from the call stack? Something else must be calling set_scale...
I can think of a thing or two which can cause this, thanks to Unity's unpredictable script execution order. I'll put some more tests in for next alpha, maybe tonight or tomorrow.

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #10 on: October 03, 2012, 03:16:51 am »
Yes, sorry. I was setting the scale of a 1px sprite to be the width of the screen, but I was doing that inside an Awake(). I moved that to Start() and it works fine now.

fsadeq

  • 2D Toolkit
  • Sr. Member
  • *
  • Posts: 353
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #11 on: October 03, 2012, 03:27:13 am »
Nevermind, it still does it even when I move to Start(). It happens when the scene-is reloaded, but fine when I run the scene for the first time. Bah.

DannyB

  • 2D Toolkit
  • Hero Member
  • *
  • Posts: 609
    • View Profile
    • Chicks Ahead
Re: 2D Toolkit 1.80 Alpha 3
« Reply #12 on: October 03, 2012, 07:46:41 am »
Ok, so I have installed this on my biggest project and the first impression is that nothing seems broken.
I did not yet test any of the new platform features, this comes next, hopefully later today.

The only warning I get is this of unused variable:
Assets/TK2DROOT/tk2d/Editor/tk2dGuiUtility.cs(258,24): warning CS0219: The variable `start' is assigned but its value is never used

I will keep reporting as I play with it more.

EDIT:
First error encountered.

This happened when I took these steps:
  • I opened the editor window for a sprite collection just to see all is good (I get an info message: SpriteCollection 'Name' - Upgraded from version 0).
  • I closed it without committing.
  • I then went to edit the animation of the same collection.
  • Unity showed the progress bar, with "Looking for Assets" or something like that.
  • When all finished, I noticed an error in the console, pasted below.
  • I tried reproducing it with other collections, but I could not make the same error appear again, so not sure if this is helpful at all.

Code: [Select]
ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at C:/BuildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/Editor/GUILayoutUtility.cs:417)
UnityEngine.GUILayoutUtility.BeginLayoutArea (UnityEngine.GUIStyle style, System.Type LayoutType) (at C:/BuildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/Editor/GUILayoutUtility.cs:184)
UnityEngine.GUILayoutUtility.DoBeginLayoutArea (UnityEngine.GUIStyle style, System.Type LayoutType) (at C:/BuildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/Editor/GUILayoutUtility.cs:195)
UnityEditor.EditorGUILayoutUtilityInternal.BeginLayoutArea (UnityEngine.GUIStyle style, System.Type LayoutType) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/MonoGenerated/Editor/EditorGUI.cs:4188)
UnityEditor.DockArea.BeginOffsetArea (Rect screenRect, UnityEngine.GUIContent content, UnityEngine.GUIStyle style) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/GUI/DockArea.cs:740)
UnityEditor.DockArea.OnGUI () (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/GUI/DockArea.cs:633)
« Last Edit: October 03, 2012, 08:00:12 am by DannyB »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #13 on: October 03, 2012, 10:21:14 am »
Nevermind, it still does it even when I move to Start(). It happens when the scene-is reloaded, but fine when I run the scene for the first time. Bah.

The next beta will sort this out. I was trying hard to avoid having if (!initialized) stuff everywhere, but it looks like its impossible the way Unity works. Thankfully this doesn't need to be everywhere, but just in select places.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2D Toolkit 1.80 Alpha 3
« Reply #14 on: October 03, 2012, 10:25:49 am »
Ok, so I have installed this on my biggest project and the first impression is that nothing seems broken.
I did not yet test any of the new platform features, this comes next, hopefully later today.

The only warning I get is this of unused variable:
Assets/TK2DROOT/tk2d/Editor/tk2dGuiUtility.cs(258,24): warning CS0219: The variable `start' is assigned but its value is never used

I will keep reporting as I play with it more.

EDIT:
First error encountered.

This happened when I took these steps:
  • I opened the editor window for a sprite collection just to see all is good (I get an info message: SpriteCollection 'Name' - Upgraded from version 0).
  • I closed it without committing.
  • I then went to edit the animation of the same collection.
  • Unity showed the progress bar, with "Looking for Assets" or something like that.
  • When all finished, I noticed an error in the console, pasted below.
  • I tried reproducing it with other collections, but I could not make the same error appear again, so not sure if this is helpful at all.

Code: [Select]
ArgumentException: Getting control 0's position in a group with only 0 controls when doing Repaint
Aborting
UnityEngine.GUILayoutGroup.GetNext () (at C:/BuildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/Editor/GUILayoutUtility.cs:417)
UnityEngine.GUILayoutUtility.BeginLayoutArea (UnityEngine.GUIStyle style, System.Type LayoutType) (at C:/BuildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/Editor/GUILayoutUtility.cs:184)
UnityEngine.GUILayoutUtility.DoBeginLayoutArea (UnityEngine.GUIStyle style, System.Type LayoutType) (at C:/BuildAgent/work/14194e8ce88cdf47/Runtime/ExportGenerated/Editor/GUILayoutUtility.cs:195)
UnityEditor.EditorGUILayoutUtilityInternal.BeginLayoutArea (UnityEngine.GUIStyle style, System.Type LayoutType) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/MonoGenerated/Editor/EditorGUI.cs:4188)
UnityEditor.DockArea.BeginOffsetArea (Rect screenRect, UnityEngine.GUIContent content, UnityEngine.GUIStyle style) (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/GUI/DockArea.cs:740)
UnityEditor.DockArea.OnGUI () (at C:/BuildAgent/work/14194e8ce88cdf47/Editor/Mono/GUI/DockArea.cs:633)

That error is safe to ignore, its just a Unity GUI thing. I've seen it a few times - I think it happens when the index is first created, but just ignored for now as it doesn't really cause any problems.