2D Toolkit - 2D in Unity made simple [RELEASED]

Discussion in 'Assets and Asset Store' started by unikronsoftware, Jun 16, 2011.

  1. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    I will send you a PM to discuss this further.

    unikron

  2. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Version 1.06 has been submitted to the Asset Store

    Changelog:

    - Fixed bug with multiline text
    - Support for uniform sprite sheets. Set up a tiled sprite sheet texture, and the system will extract and crop each tile automatically.
    - Bugfix in autofill, now will recognize 0000, 0001, etc. in addition to 1,2,3, etc.
    - Animation events can be set up and will be triggered while the animation is playing. Animation demo scene has a demonstration of this feature.
    - Updated documentation

    unikron
  3. edwood_grant

    edwood_grant

    Member

    Joined:
    Jan 11, 2010
    Messages:
    29
    Hello,

    I've just upgrade and I recieve this error

    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. tk2dAnimatedSprite.Play (Int32 id) (at Assets/TK2DROOT/tk2d/Sprites/tk2dAnimatedSprite.cs:59)
    4. tk2dAnimatedSprite.Play (System.String name) (at Assets/TK2DROOT/tk2d/Sprites/tk2dAnimatedSprite.cs:33)
    5. Character.ChangeRandomState () (at Assets/Scripts/Character.cs:249)
    6. Character.Start () (at Assets/Scripts/Character.cs:121)
    7.  
    As far as I can see it has to do with my Sprite Animation Asset. Probably it has not updated to the new changes using tirggers and such?

    I could recreate the whole Sprite animation Asset, but that would be tiresome. Do you know any way to update the Sprite animation si it can work with the new version?


    Edit: Upon further revision it might not be the case. I've just created another sprite animation asste with differente frames an the same error occurs.. I'll try to figure what could be going on.

    Update: I've found the issue, apparently in tk2dAnimatedSprite.cs you have this at line 57:

    Code (csharp):
    1.  
    2. currentClip = null;
    3.  
    4. if (currentClip.frames[0].triggerEvent)
    5. {
    6. ...
    7.  
    So, by deleting the currentClip = null; sentence solves the problem, although I don't know if it might break something inside the 2D Toolkit. Hope this helps :).

    Thanks,
    Italo F. Capasso B.
    Last edited: Aug 5, 2011
  4. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Just had a look at is a genuine bug which snuck in with the triggers :(
    It only happens under certain conditions, one of which occurs when your sprite is set up to start with an invalid clip (no frames) or when it has only one frame.

    You can fix it temporarily by moving tk2dAnimatedSprite line 59 further down, like so:


    I will send an update straight away to fix this issue, but in the mean time you can do that to get around the problem. Sorry for any inconvenience.

    unikron

  5. Jodon

    Jodon

    Member

    Joined:
    Sep 12, 2010
    Messages:
    101
    I'm using the latest tk2d with the fix above. It seems when I change the text of a textmesh, some characters get left behind. It appears the quads stay behind, and only a particular letter ('o' in my case). The o letter doubles-up with the new string, so it looks mostly fine except for a few letters that appear garbled due to the o quad being ontop of it. I'm using multi-line strings in-case that helps track it down.
  6. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Does that happen with single line strings? I have been trying to reproduce it and it doesn't seem to happen over here. Could you email or pm a unity package with the font you are using, in case it's something to do with that?

    Unikron
  7. sicga123

    sicga123

    Member

    Joined:
    Jan 26, 2011
    Messages:
    316
    I tried using the new spritesheet feature but got an error. The sprite sheet is 2560 by 2560pixels so pretty large, and there are 5 columns and 5 rows to give 25 frames. The error window stated that there were a different number of frames than expected.
  8. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    This is a bug. We will be submitting an update with this fix. Thanks for reporting this.

    Drop me a PM if you need this sooner and I'll send you a link to the fixed file, as I don't think this update will be approved over the weekend.
    This applies to anyone else who needs it too, as this bug is pretty nasty.

    unikron
  9. bryanleister

    bryanleister

    New Member

    Joined:
    Apr 28, 2009
    Messages:
    130
    I've found two issues with the TextMesh -

    In a new scene, create an animated Sprite and a TextMesh. Hit Play and selecting the Textmesh in the Editor generates this warning:
    Code (csharp):
    1. The referenced script on this Behaviour is missing!
    2. UnityEditor.AssetDatabase:LoadAssetAtPath(String, Type)
    3. tk2dEditorUtility:FindPrefabsInProjectWithComponent() (at Assets/TK2DROOT/tk2d/Editor/tk2dEditorUtility.cs:71)
    4. tk2dTextMeshEditor:OnInspectorGUI() (at Assets/TK2DROOT/tk2d/Fonts/Editor/tk2dTextMeshEditor.cs:15)
    5. UnityEditor.DockArea:OnGUI()
    That doesn't crash Unity, but I've isolated the TextMesh as causing a crash when they are in the scene and are referenced by another script. When I hit the Play button, to stop the animation, I get the following Unity crash and error:

    Code (csharp):
    1. Fatal Error!
    2. GetManagerFromContext: pointer to object of manager 'kScene' is NULL (table index 17)
    3.  
    I wish I could create a reproduceable scene for the crash, but it seems like it must be related to the way my scripts are accessing the TextMesh. If it's all set up, it runs fine. I have one scene with working TextMeshes and animated sprites with no problems.

    But in another scene where I don't really need the TextMesh objects, if I leave them in there and don't hook them up to my scripts it seems to create the crash. I deleted the TextMesh objects from that scene and it stopped the crashing.
  10. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Hi Bryan,

    Regarding the first issue, is that reproducible? If so, would you be happy to send me a test case to fix this issue?

    With the second crash, what version of Unity are you running? Also, how are you accessing the TextMesh object? Its a shame it isn't reproducible, as I would really like to get to the bottom of this.

    unikron
  11. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Hi all,

    To fix the issue with sprite sheets not building correctly, and non-power-of-two textures not working correctly, please change the following lines while waiting for the update to be approved:

    tk2dSpriteCollectionEditor, line 291

    Code (csharp):
    1.  
    2.  
    3.         foreach (var tex in texturesToProcess)
    4.         {
    5.             // make sure the source texture is npot and readable, and uncompressed
    6.             string thisTextPath = AssetDatabase.GetAssetPath(tex);
    7.             TextureImporter importer = (TextureImporter)TextureImporter.GetAtPath(thisTextPath);
    8.             if (importer.textureType != TextureImporterType.Advanced ||
    9.                 importer.textureFormat != TextureImporterFormat.AutomaticTruecolor ||
    10.                 importer.npotScale != TextureImporterNPOTScale.None ||
    11.                 importer.isReadable != true ||
    12.                 importer.maxTextureSize < 4096)
    13.             {
    14.                 importer.textureFormat = TextureImporterFormat.AutomaticTruecolor;
    15.                 importer.textureType = TextureImporterType.Advanced;
    16.                 importer.npotScale = TextureImporterNPOTScale.None;
    17.                 importer.isReadable = true;
    18.                 importer.mipmapEnabled = false;
    19.                 importer.maxTextureSize = 4096;
    20.                
    21.                 AssetDatabase.ImportAsset(thisTextPath);
    22.  
    23.                 numTexturesReimported++;
    24.             }
    25.         }
    26.  
    27.  
  12. leegod

    leegod

    Member

    Joined:
    May 5, 2010
    Messages:
    1,068
    Is this good than sprite manager (anbsoft.com) ?
  13. Ace20

    Ace20

    New Member

    Joined:
    Oct 27, 2010
    Messages:
    20
    Hey, I'm trying to make a game with tk2d where all the sprites lie flat on the XZ plane. Would it be possible to add an option to sprites or somewhere to rotate their mesh to fit a certain plane without having to actually rotate the transform (so that it reads (0,0,0) but is still lying flat on the plane)? I tried rotating the sprites manually by setting the X rotation to -90 or 90, but that causes me to get gimbal lock when rotating along the Y or Z axes, which also does weird stuff when I try to translate the object.
  14. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    We can definitely add that as an option, but I'm just trying to find out what you're trying to do it and why. All the data is precomputed, and having selectable planes will mean swizzling the data which just adds that little bit extra computing which we have been working quite hard to avoid. In addition, we are planning on doing a 2d particle system add-on to throw around large numbers of animating 2d particles and when that happens, the additional computation will make more of a difference then.

    Have you tried parenting your sprites to an empty gameobject which is located at the origin, and rotated around X? This will probably give you a close result to what you want (though this won't be perfect). You will need to move your sprites using transform.position but rotate using transform.localRotation.z.

    I suppose, I am trying to dissuade you from going down this path, but if you need it we can certainly add it as it will only be a few lines of code. The performance reasons were why this wasn't an option even in the first place, while all the other 2d packages seem to support it. Let me know your thoughts and we can proceed from there.

    unikron
  15. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    The focus of the two products is really quite different, though they seem the same / similar.

    We perform as much computation as possible offline, and our runtime code is ridiculously simple. Each created sprite is automatically pixel perfect (if you set everything up correctly), and no computation is performed for this.

    Our product also rebuilds the atlas when the source files are modified, which fits in really nicely into a prototyping pipeline. How we work in house is a programmer/artist sets up some placeholders, builds the sprite collection and starts coding. Other artists can update the source files, and the atlas will get updated while the game is running within the editor as well (within reason, as if you replace a 42x42 texture with a 420x420 one, the atlas is not going to fit any more and everything will be downscaled). This is really good for "getting the sprite just right" at frame 43 when the game is running.

    Our "sprites" are also not limited to 4 vertices, and we use this to our advantage to split up large images and crop out blank areas. A good use for this is for a HUD which covers the 4 corners of the screen. Its nice to be able to work as one big image, set up the dicing options and in your game, it simply appears as a mesh with a number of polygons, all happening quite seamlessly. A lot of the blank space will be trimmed out of your image, so you don't have to chop up your images by hand, or save them like that. Again, save this in your image editing app, and the atlas will be regenerated automatically and your scene updated.

    Theres a lot of other little things like that which set this library apart from the other sprite libraries out there, check out the videos to see a bit of what I mean.

    unikron
  16. bryanleister

    bryanleister

    New Member

    Joined:
    Apr 28, 2009
    Messages:
    130
    I re-imported the toolkit and the first problem seems to have gone away. It seems to work best to delete the Toolkit folder entirely, and do a complete re-import from the Asset store.

    For the second problem, the crash, I tried to make a reproducible scene and in the process found that in fact deleting the UIToolkit that I also had in the scene stopped the crashing. So, it may not have been the 2DToolkit after all. I really haven't had time to test and figure out what is up with the UIToolkit, it could be me. I actually was thinking of scrapping the Primesense UIToolkit anyway and just using your 2D Toolkit for everything. Hoping to get my game down to a single Sprite.

    Do you have suggestions or a tutorial on a simple way to use your sprites for a GUI interface? I already have an ortho camera for the Player, and would probably just add some sprites as children to my camera so it moves along with everything. I suppose I could adjust the Joystick.js sample that comes with the mobile, but was wondering if you had any suggestions that work well with your system.

    Bryan
  17. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    You could attach your sprites to the main camera like you say, though what we do is create a second ortho camera far away and set it to only draw some tagged elements. We also use the built in unity animation system to animate various things in the interface, like in-out transitions, etc. for our front end interfaces, we simply have multiple cameras, and animate each of them independently.

    We will be adding the button and counter classes to the toolkit at some point in the future, but they will just be unsupported bonus materials.

    Unikron

  18. 2Dsprite.com

    2Dsprite.com

    New Member

    Joined:
    Jun 9, 2011
    Messages:
    74
    I know this has already been asked a thousand times, and just 5 minutes ago was asked AND answered.

    However, I'd be interested in seeing a "Feature Lineup" like how many websites compare their product versions with a feature list.
    Specifically, one containing all of the 2D plugins, showing off various features.
    Yet since this is a specific thread, then this vs SM2. Really, all a lot of us know is SM2, so knowing if it's better/worse and in what ways really helps.

    In the end though, they all do pretty much the same thing... and this one is 1/3rd the price of SM2 (if I'm not mistaken) so I'm sure this is superior, hands down.

    So I guess I'll ask a different question...

    Are there any specific features that would help me develop 2.5D isometric games (2D, but Dimetric Tiles), or link together sprites (like square tiles) easier?

    There's just so many 2D asset packages, it's mindblowing to know which to pick, and which is better.
  19. 2Dsprite.com

    2Dsprite.com

    New Member

    Joined:
    Jun 9, 2011
    Messages:
    74
    One of my biggest concerns in a 2D animation package is actually...

    1) Speed of adding sprites. I have thousands upon thousands of images. A single animation is hundreds. They all have number ranges (North direction is 0-41, North East is 42-83, etc. etc.) but I have to sort these into folders first, and then after having a folder for each direction, I have to then go through a lengthy process "Add Animation +", Name animation (the exact same name as ALWAYS-- the direction N, S, E, W, NE, SW, NW, SE), making sure these are assigned the same order to give the same sprite number (N = 0, E = 1, S = 3, etc. etc.), then drag and drop the entire folder in, and do this 8 times per animation, per character, per item, per outfit. Then I have to name each individual variation of the animation in a SuperSprite which handles all these other sprites-- after storing them all in prefabs, and making sure they are always the same resolution % which I downsize them to be!
    Honestly, it takes longer just to implement the sprite into unity because of how long it takes me to name the same 8 directions over and over again. Every single "Add Animation +" in SM2 is given "New Animation" as the name.

    If 2D toolkit automatically saved the name hierarchy that I originally had, that would save me a lot of time! One sprite could have 8 animations inside of it, ALWAYS named, in order, N E S W NE NW SE SW, and the ability to drag ALL images and have it KNOW that name_000.png to name_042.png is ALWAYS North (N), name_043.png to name_085.png is ALWAYS East (E), etc.

    Then I can just have ONE sprite, and drag all images into that sprite ONCE, and everything is setup.

    The naming convention _000.png is always the same. The direction and order is always the same.
    Yet it takes me hours to implement a sprite in SM2 with all its thousands of images, directions, and equipment, and image sorting into folders.

    Sometimes I have to do it this way because the way the sprite sheet creator in SM2 handles making sprite sheets. It can't make more than 1, and you have to redo everything if you change ANYTHING! When dealing with thousands upon thousands of images and sprite sheets, what a PITA!
    Last edited: Aug 7, 2011
  20. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    The next release, or perhaps the one after that, will support multiple atlas generation for animated sprites. This will be limited to animated sprites, and will automatically create as many atlases as required to hold the sprites. This will be separate to the normal sprite collection interface, as it doesn't really fit into the workflow.

    This will certainly speed up your workflow quite massively.

    Currently, you will still need to create multiple atlases manually, but adding frames to animations is quite fast, as you add the first frame and click auto fill to fill out the frames.

    Unikron

  21. bryanleister

    bryanleister

    New Member

    Joined:
    Apr 28, 2009
    Messages:
    130
    Starting to get a Joystick up and running using an ortho camera and am now getting overwhelmed by the number and types of GUI solutions for iOS. Now I can see why there are so many tool kits for GUI, just getting a simple, accurate touch event on a GUI control is pretty complex. How do you handle your GUI controls for your games? Colliders on the Sprites, or checking coordinates of touches? Or, Raycasting?

    I would rather write my own script than use another packaged solution, so any pointers for doing the following:

    1. Use an animated sprite for a simple button that the player can hold down or for a single press
    2. Switch to a different animation (Single) when pressed, and then back to normal when up
    3. Must be very reliable, so when the player stops touching, it needs to know that immediately.

    It seems like most of the GUI scripts include their own versions of sprite management, and it seems like a project to get any of them to work with a button of my own.

    I really like the simplicity and workflow of the 2DToolkit sprites. For my game, it seems like I can make anything I need and am getting great performance on an iPhone 3G, which is my base test device.

    I like seeing my sprites as meshes in game, so that I can animate them or whatever I need to in addition to running the sprite animation. Should be perfect for my GUI and menus as well once I get the buttons implemented.

    Bryan
  22. jjobby

    jjobby

    New Member

    Joined:
    Nov 28, 2009
    Messages:
    58
    May I ask why Pixel perfect sprites and sprite animations video is private?
  23. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    I have no idea, I probably set it up like that and totally forgot about it! I'll change that now.
  24. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    We just have a simple Button script which is some thing like this:

    Code (csharp):
    1.  
    2.  
    3. string message;
    4.  
    5. void Update()
    6. {
    7.         if (Input.GetMouseButtonDown(0))
    8.         {
    9.             Ray ray = myCamera.ScreenPointToRay(Input.mousePosition);
    10.             RaycastHit hitInfo;
    11.             if (collider.Raycast(ray, out hitInfo, 100.0f))
    12.             {
    13.         animatedSprite.Play("buttonDown");
    14.         StartCoroutine(ButtonDown());
    15.             }
    16. }
    17.  
    18. IEnumerator ButtonDown()
    19. {
    20.         bool hit = true;
    21.         while (Input.GetMouseButton(0))
    22.         {
    23.             Ray ray = myCamera.ScreenPointToRay(Input.mousePosition);
    24.             RaycastHit hitInfo;
    25.             if (!collider.Raycast(ray, out hitInfo, 100.0f))
    26.             {
    27.                 hit = false;
    28.             }
    29.             else
    30.             {
    31.                 hit = true;
    32.             }
    33.  
    34.           yield return 0;
    35.         }
    36.         animatedSprite.Play("buttonUp");
    37.         if (hit  targetObject) targetObject.SendMessage(message);
    38. }
    39.  
    40.  
    You obviously need a bit more code in there to make sure the cursor (or touch event, Input.mousePosition reads touch events too) stays within the confines of the collider, and play sounds, etc. I mostly typed that from memory as I'm away from my computer, so I do expect that you'll need to make it work!

    We'll be tidying up our script and releasing it as an unsupported bonus in a later update.

    unikron
  25. activate_mc

    activate_mc

    New Member

    Joined:
    Jun 1, 2011
    Messages:
    9
    Any games made from this 2D toolkit yet? Would be nice to see a working sample even it is a small one.
  26. oliverdb

    oliverdb

    New Member

    Joined:
    Jan 30, 2010
    Messages:
    165
    Hey

    Purchased the 2D toolkit, and I wanted to load a sprite into a Texture2D for usage in UnityGUI... any idea if thats possible?

    I did a solution like below... anything that can go wrong?

    Code (csharp):
    1.  
    2. public class AdvertisningScreen : WagScreen {
    3.    
    4.     public Texture2D adv_textureAtlas;
    5.     private GUIStyle blankStyle = new GUIStyle();
    6.     public GameObject guiSprite;
    7.     public  int ypos = -480;
    8.    
    9.     public Texture2D advScreen;
    10.    
    11.     void OnAwake(){
    12.        
    13.        
    14.         //advScreen = ((tk2dSpriteCollection)guiSpritetextureRefs[0];
    15.     }
    16.     void OnEnable(){
    17.         advScreen = guiSprite.GetComponent<tk2dSpriteCollection>().textureRefs[0];
    18.         iTween.ValueTo(gameObject,iTween.Hash("time",1,"from",ypos,"to",0,"easetype",iTween.EaseType.easeInOutExpo,"onupdate","applyAnimation"));//,"onupdate","applyAnimation","oncomplete","onAnimationINComplete")
    19.     }
    20.     void applyAnimation(int pos ){
    21.         ypos = pos;
    22.        
    23.     }
    24.     void OnDisable(){
    25.         ypos = -480;
    26.     }
    27.     void OnGUI(){
    28.         initScreenGUI();
    29.         //GUI.BeginGroup(new Rect(0,0,1024,1024));
    30.             GUI.Label(new Rect(0,ypos,320,480),advScreen,blankStyle);
    31.         //GUI.EndGroup();  
    32.     }
    33.    
    34. }
    35.  
    36.  
    Last edited: Aug 8, 2011
  27. bryanleister

    bryanleister

    New Member

    Joined:
    Apr 28, 2009
    Messages:
    130
    Thanks, that helped a lot. Here's a complete working example. To get a 2D sprite button do the following:

    1. Make a new camera, set to Ortho, that renders only a UILayer
    2. Make an animated sprite, set the layer to UILayer
    3. Attach this script to it

    What I'm doing is also adding a text object as a child to the animated sprite, so I can use the same button graphics, and then retype the text for each button. Then, I'm putting my buttons as children to the new GUI camera, where I plan to animate the set of buttons as needed. That way, all my buttons, game over text, etc. will be accessible by calling the desired animation from my GUI camera. This is just the simple scheme I was looking for!

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class GUIButton2Dtk : MonoBehaviour
    5. {
    6.     public  string              message;
    7.     public  Camera              myCamera;
    8.     public  Transform           targetObject;
    9.    
    10.     private tk2dAnimatedSprite  animatedSprite;
    11.    
    12.     void Start ()
    13.     {
    14.         animatedSprite = GetComponent<tk2dAnimatedSprite>();
    15.            
    16.     }
    17.  
    18.     void Update()
    19.     {
    20.         if (Input.GetMouseButtonDown(0))
    21.         {
    22.             Ray ray = myCamera.ScreenPointToRay(Input.mousePosition);
    23.             RaycastHit hitInfo;
    24.             if (collider.Raycast(ray, out hitInfo, 100.0f))
    25.             {
    26.                 animatedSprite.Play("buttonDown");
    27.                 StartCoroutine(ButtonDown());
    28.             }
    29.         }
    30.     }
    31.  
    32.     IEnumerator ButtonDown()
    33.     {
    34.         bool hit = true;
    35.        
    36.         while (Input.GetMouseButton(0))
    37.         {
    38.             Ray ray = myCamera.ScreenPointToRay(Input.mousePosition);
    39.             RaycastHit hitInfo;
    40.            
    41.             if (!collider.Raycast(ray, out hitInfo, 100.0f))
    42.             {
    43.                 hit = false;
    44.             }
    45.             else
    46.             {
    47.                 hit = true;
    48.             }
    49.  
    50.           yield return 0;
    51.         }
    52.        
    53.         animatedSprite.Play("button");
    54.        
    55.         if (hit  targetObject)
    56.         {
    57.             //targetObject.SendMessage(message);
    58.             Debug.Log("You hit me!");
    59.         }
    60.     }
    61. }
    62.  
  28. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Yes, this is not a good way of doing it. By grabbing a sprite collection directly, you are bypassing the texture atlas, and while it will work, it will also include all your loose textures into your project.

    I'm guessing you simply want to have a texture displayed on the screen? In that case, all you need to do is Create a new Sprite (Hierarchy > Create > tk2d > Sprite), position it where you want, and reference that GameObject from your script. You can then select the appropriate sprite using the interface. If you then parent this to your Camera, it will always appear at the same location. You can use the built in Unity Animation System to animate your sprites, or even use iTween to perform the animation.

    You can't really use the sprite in UnityGUI as UnityGUI doesn't support extracting parts of textures which is required to use a texture atlas.

    unikron


  29. oliverdb

    oliverdb

    New Member

    Joined:
    Jan 30, 2010
    Messages:
    165
    I can see that but unfortunatly I have a rather complex UI consisting of more than just buttons, so I need UnityUI, guess I will have to live with the memory overhead for now ;-(
  30. Ace20

    Ace20

    New Member

    Joined:
    Oct 27, 2010
    Messages:
    20
    Hi, sorry I was out of town.

    Oh, if it's going to cause that much of a performance slowdown then I guess I won't bother. I was just thinking it would be convenient to have everything lying flat on unity's grid rather than perpendicular to it, otherwise the grid is kind of meaningless. I'll stick to the XY axis, in that case. :p
  31. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    We have started preparing the next release.

    The new features for the next release will be:

    - Improved font / sprite picking using prefab object (thanks for highlighting the issues with a large number of prefabs in the project, Loud). Performance within the interface is now massively improved.

    - New atlasing algorithm instead of using the built-in Unity one.

    - Able to set up maximum sprite size on SpriteCollection, will present error dialog box if the built atlas exceeds this size.

    - Animated sprites will be able to span multiple atlases, and are automatically sorted by name and substrings. Animations are automatically created for the ones based on name, and manually created animations are retained.

    - Button gui script and demo scene

    - Multiple resolution support (have multiple source images and automatically create multiple atlases for automatic sprite scaling from iPhone4 to iPhone 3G/S resolutions). The atlas generation part of this feature will probably make it in the next release, as it is half complete, but the runtime code may not be in a state fit for general use.

    Since this release will be quite large, and contain features we do not really use in house (sprites spanning atlases, etc), it is probably a good idea to release beta versions before submitting to the Asset Store.

    If you have purchased 2d toolkit, and wish to help test these betas, or simply to get your hands on these new features sooner, please drop me a PM with your email address invoice number and I will send you a private link to the current version.

    unikron
  32. oliverdb

    oliverdb

    New Member

    Joined:
    Jan 30, 2010
    Messages:
    165
    Hey

    I am now trying to use the 2D toolkit and I a have the following setup.

    1) Ortho camera with a size of 10
    2) one background with size of 320X 480 on a sprite
    3) a spritecollectionw with target height 480

    But I cannot make the background be pixel perfect, what am I doing wrong?
  33. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Hi,

    You need to set your target ortho size in the Sprite Collection to 10 (the same as the camera). If you now create this sprite in the viewport it will be pixel perfect. You should check the atlas texture to make sure it isn't compressed if you want it to be exact. You don't need to press the Make Pixel Perfect, as that makes your sprite pixel perfect in relation to the main camera (which may be perspective).

    unikron

  34. oliverdb

    oliverdb

    New Member

    Joined:
    Jan 30, 2010
    Messages:
    165
    Yep I did that, but it did not work. What worked was to set the cam ortho to 10 and the collection ortho to 1?

    Got some weird bugs too

    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. tk2dSpriteEditor.DrawSpriteEditorGUI (.tk2dSprite sprite) (at Assets/TK2DROOT/tk2d/Sprites/Editor/tk2dSpriteEditor.cs:65)
    4. tk2dSpriteEditor.OnInspectorGUI () (at Assets/TK2DROOT/tk2d/Sprites/Editor/tk2dSpriteEditor.cs:24)
    5. UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty)
    6. UnityEditor.InspectorWindow.OnGUI ()
    7. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
    8. UnityEditor.PopupCallbackInfo:SetEnumValueDelegate(Object, String[], Int32)
    9.  

  35. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    I'm just checking just in case, do you have the resolution in the Game window to be the same as specified in the Sprite Collection? By default the height is 640, and is targetting the iPhone4 resolution (960x640). I have tested this and it is definitely working. If you want, feel free to send a test scene via PM and I will check it out for you.

    Regarding the bug, any idea what you did for it to happen? Looking at the code, it looks like you have a sprite in the scene created from a sprite collection has been deleted. Reopening the scene should fix that.

    unikron

  36. arcandio

    arcandio

    New Member

    Joined:
    Aug 30, 2009
    Messages:
    69
    I really like this tool so far, but I have a question about the textures. When I make an atlas and just drag textures in, it tells me that they are not readable. I can change this manually, but it takes a LONG time with a lot of textures. Is there a faster way of changing the settings on all my sprites at once?
  37. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    This bug should have been fixed with 1.06c. You shouldn't have to change the textures by hand, it is done automatically for you.

    Unikron
  38. arcandio

    arcandio

    New Member

    Joined:
    Aug 30, 2009
    Messages:
    69
    Redownloading fixed it.You must be putting out patches every few hours =D
  39. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Haha. These were submitted very close to one another, but it's taking a while to approve on the Asset Store
  40. harrisyu

    harrisyu

    New Member

    Joined:
    Jun 8, 2011
    Messages:
    3
    Hi!
    I have problem to autofill sequence,and finally I found out that my file name is in UpperCase;
    in tk2dSpriteAnimationEditor.cs
    You use in function autofill():
    string baseName = na.Substring(0, numStartA).ToLower();
    to get baseName,but in function FindFrameIndex() you use:
    if (System.String.Compare(baseName, 0, spriteDefs[j].name, 0, baseName.Length) == 0)
    to find the match name,but in this case you need to use:
    if (System.String.Compare(baseName, 0, spriteDefs[j].name, 0, baseName.Length,true) == 0)
    to ignore the case..
  41. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Hi,

    Thanks for reporting that. I will get that included in the next patch. We are currently in beta testing with it now, to try and catch issues with the features we don't use extensively internally.

    unikron


  42. Nicki

    Nicki

    New Member

    Joined:
    Aug 15, 2011
    Messages:
    4
    Hey Unikron,
    Do you have an ETA of the next release?
  43. gabidof

    gabidof

    New Member

    Joined:
    Jun 15, 2011
    Messages:
    14
    Hi, how can i "trigger" or use with coding to the "Play Automatically" in the Animated Sprite? I want to used various Animated Sprite when i play with my main character, when i pressed the left or right on the keyboard.

    Thanks
  44. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    All you need to do is call Play("animation name") on your tk2dAnimatedSprite class when moving left or right. Check the animated sprites sample which contains an example of playing animations from code.

    I have replied your PM with a link to the beta.
  45. danielvmacedo

    danielvmacedo

    New Member

    Joined:
    Nov 2, 2009
    Messages:
    24
    Man i love this tool! Thank you very much!!! It just saved me a lot of work :)
  46. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Glad you like it!
  47. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    The latest beta has been posted to the beta site. This is the first feature complete version of the next major version (1.10).

    The main feature in this version is support for building into multiple atlases. When this feature is enabled on a sprite collection, two features will be restricted: sprite dicing and the static sprite batcher. The main use case for this is for sprite animations, where having them span multiple atlases will not be an issue and cause unexpected draw call increases.

    As this is a pretty major release, we will be beta testing it for a while. If anyone would like to help beta test it, or get their hands on it sooner, send me a PM, and don't forget to include your invoice number.

    unikron
  48. TimB

    TimB

    Member

    Joined:
    Jan 19, 2011
    Messages:
    55
    Is there any support for gui components built into 2D toolkit? Also, is there a trial version I can try?

    Thanks
  49. unikronsoftware

    unikronsoftware

    Member

    Joined:
    May 21, 2011
    Messages:
    1,205
    Hi Tim,

    There aren't any GUI components built in. However, we will be adding an example button script to the next version which is currently in beta testing. Unfortunately, there isn't a trial right now. I can see the value of a trial, but the whole system is quite integrated as a whole and isolating bits for a trial will require a lot of engineering effort which quite frankly, we'd rather spend adding more features to the product.

    Cheers,
    Unikron
  50. oliverdb

    oliverdb

    New Member

    Joined:
    Jan 30, 2010
    Messages:
    165
    Hej Unikron

    I am getting small "smudge" errors on some of my sprites, like its cutting out something from other parts of the spritesheet, futhermore some of the texttures change a bit in the scene but it's not visible, any advice?

    The bottom of the picture looks weird
    [​IMG]

    Here it is in the atlas
    [​IMG]

    Smudge
    [​IMG]

    In texture Atlas
    [​IMG]