ex2D - the best 2D sprite solution for Unity [RELEASED]

Discussion in 'Assets and Asset Store' started by Wu Jie, Aug 24, 2011.

  1. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    [​IMG]
    ex2D v2 Beta-Test is live, click the link below to get ex2D v2 Beta

    ex2D v2 Beta Release


    Hello Guys,

    Just back from ex2D project. I'm here to say sorry that I'm Super Busy in the last year, and that make me developed slow event stop ex2D project for a long time. The good news is I'm back to the project and I'm happy to announced ex2D v2.0 after all. I hope you can understand.

    The ex2D v2.0 is in beta-test state, we will open the site, sending the beta test package and collect feedback in the next few days. For people who already bought ex2D v1.+, it is Free upgrade to v2.0. But remember ex2D v2.0 is totally re-design for the working pipeline and data structure, so it is NOT compatible with the ex2D v1.+ projects.

    The biggest difference between ex2D v2.0 and older version is the changes of the rendering pipeline. We are working hard to optimise sprite rendering, instead of using Unity's dynamic batching method, we are making the sprites batch together in one mesh at the beginning, and dynamically combining meshes when sprite changes. It is proved in this way, we are 10%-30% faster compare to other 2D framework/plugins in both PC and mobile devices.

    In the mean time, we re-design the working pipeline and editor for making sprite assets. We temporarily remove the auto-detect and sync method from texture to atlas. It prevent people suffer out of memory problem in huge project. Instead, we are planing adding manually and automatically update in each asset generator/editor. We also rewrite most editor to support lots of small new feature such as group editing, rotated atlas texture element, ...

    Another new feature is a 2D scene editor we wrote start from scratch. The scene editor is managed to make editing 2D scene easier compare to directly editing sprites in Unity's Scene View window. The editor support layers to put sprite ( Yes, like what you do in Photoshop ), rotate, resize what ever you can image to editing 2D element in a fashion editor. In the future it will support Tile-map editing and sprite alignment.

    I post this thread to thank you for supporting ex2D v1.+ and to make people understand my state last year. We will start up beta test very soon, so if you have any question about ex2D v2.0 project, try to contact us through EMail: support@ex-dev.com

    ex2D is now available on the Asset Store for $35 .

    You can also buy it in our Web Store for $35.
    Source Code included license will coming soon.

    Current Version: v 1.2.7 (Updated 2012.11.09)

    Links


    Downloads

    FAQ

    Q: Why choose ex2D?
    A: 7 Reasons To Choose ex2D For Unity

    Q: Where can I submit an Issue?
    A: In this forum thread or in github page

    Q: How can I submit an Issue?
    A: Step by step to submit an issue in github

    Q: Can I have the source code?
    A: We only open the ex2D Runtime source code, and you can get it in github in here. If you fix any bugs in the Runtime, we really appreciate you submitting the issue and post your solution.

    Changes in v 1.2.5

    • New Features

    • Changes
      • Remove unnecessary virtual function, use new keyword instead. (120303)
      • Change exSpriteAnimation.AddAnimation() function. Now you can dynamically add different name of the animation in this sprite (120306)
      • Add SetSprite can change default animation sprite. This is good for dynamically change sprite for reusable objects (120307)

    • Bug Fix
      • Fix soft clipping popping problem. (120227)
      • Fix exSpriteAnimation.GetCurFrameIndex() return minus value. (120302)
      • Fix no atlas Prefab will show error when click the inspector (120303)
      • Fix exSpriteAnimation.Play( name, index ) the index frame will from start instead of from end (120309)
      • Fix exSprite prefab can't set camera to null (120313)
      • Fix rebuild prefabs report meshFilter_ error (120402)
      • Fix Layer Manager sometimes not update child transform (120422)
      • Fix prefab set renderCamera will report error for pixel-perfect component (120423)
      • Fix IsPaused will throw error when animation is not playing (120423)
      • Fix pixel perfect camera calculate wrong in perspective mode (120510)

    Introduction

    ex2D is a highly integrated 2D-sprite-related development extension for Unity. It aims at providing high performance 2D sprite/UI solution inside Unity, with a specific focus on creating tons of cutting-edge sprite animations and other content in complicated Unity scenes, while still maintaining great performance on mobile devices.

    [​IMG]

    ex2D includes several editor class that runs as view tabs inside Unity, to help developers making 2D assets easily. They are Atlas Editor, Font Editor, SpriteAnimation Editor, the upcoming Tile Map Editor and 2D Skinning Editor. All the editors are written by C# script and directly run in Unity.

    ex2D follows the Unity working pipeline standard closely. Unlike other 2D plugins in Unity which directly saves 2D resource in Components, we use the ScriptableObject to handle most of the 2D resource (Atlas, Sprite Animation, Bitmap Font, ... ). In this way, ex2D generates assets that easily reusable and manageable for content-rich projects. We also design several Components to reference these data when editing the scene and runtime scripting. Following the advanced asset listening technique in ex2D, developers will not need to worry about data out of the date, they will sync automatically.

    ex2D is highly optimized for mobile devices, the code is carefully written to prevent heap allocating and produce less draw calls.

    ex2D works with both the free and Pro versions of Unity! Fully tested on PC, Mac, Web, iOS and Android deveices. and produce less draw calls.

    [​IMG]

    Features

    Atlas Editor

    • Pack textures into texture atlas in an editor window inside Unity.
    • Can manually move, add and remove textures in atlas.
    • Automatically detect atlas changes and apply to the scene immediately.
    • Generate atlas asset under the standard of ScriptableObject in Unity.

    [​IMG]

    Sprite Component

    • Add this component to any GameObject to turn it into a sprite.
    • You can drag and drop texture file to the Sprite Component. The Sprite Component will detect if the texture is included in any atlas asset and choose the proper asset. If the texture is not in any atlas, it will just use the original texture file.
    • Scale sprites in game without breaking dynamic batching.
    • Choose different Anchor position for aligning the sprites in different type of Sprite Animation.
    • Support different camera direction (XY, XZ, YZ)
    • Pixel Perfect render support.
    • Layer system to help Designer and Artist sort out the rendering order of all sprites in the scene.
    • Automatically adjust the collider size when the sprite size changed.

    Sprite Animation Clip Editor

    • User friendly interface.
    • Scale and scroll enabled time line editor.
    • Move, add, remove and insert Frame Element by dragging and dropping them directly.
    • Adjustable single frame length to make animation creating more versatile.
    • Support adding animation events directly in the timeline editor.
    • Preview animation result in the editor.

    [​IMG]

    SpriteAnimation Component

    • Reference sprite animation in script by clip names.
    • Provide interface to control animation state ( play, pause, stop )
    • Support pause/resume animation.

    Atlas Font Editor

    • Support fonts export from BMfont and Hiero.
    • Multiple fonts can be put together in one big texture atlas to save draw calls.
    • Fonts can also be put together with other texture sprite to save draw calls.
    • Manage fonts easily in atlas editor.

    [​IMG]

    SpriteFont Component

    • Support rendering text from Atlas Font asset and Bitmap Font asset.
    • Support in game gradient color rendering (you can specify two colors for gradient and change them in runtime).
    • Support in game outline rendering (outline width and color are adjustable).
    • Support in game shadow rendering (offset and color are adjustable).
    • Support multi-line text.

    [​IMG]

    SpriteBorder Component

    • Support rendering Scale9Grid texture from atlas or texture.
    • Drag to resize.
    • Editor to setting Scale9Grid texture.

    [​IMG]

    SoftClip Component

    • Clip sprite, text and other sprite type in rectangle.
    • Easy to setup clip list.

    [​IMG]

    Layer Manager

    • A tree view layer editor helps user easily arrange and group layers.
    • Can edit layer in both Prefab and GameObjects.
    • Support inserting new items in a layer dynamically when running the game.

    [​IMG]

    Upcoming Features

    • Tile Map Editor and Tile Map working pipeline
    • 2D skeleton animation editor
    • 2D Skinning editor
    • 2D GUI editor

    Researching

    • Working pipeline for multiple resolution.
    • Export the 2D scenes and assets in xml and json file formation.
    • Load the exported xml/json file in Cocoa2D.
    • Load the exported xml/json file in Web-Browser(Html5).
    Last edited: Aug 19, 2013
  2. nantas

    nantas

    New Member

    Joined:
    Feb 11, 2010
    Messages:
    122
    UPDATED with new video

    Introduction of new features since 1.1.0





    Please checkout the video tutorials to get an idea how easy it is to create professional looking sprite content with ex2D



    Last edited: Oct 20, 2011
  3. jeedee

    jeedee

    New Member

    Joined:
    May 30, 2011
    Messages:
    15
    Good job guys!
  4. ChezDoodles

    ChezDoodles

    Member

    Joined:
    Sep 13, 2007
    Messages:
    54
    This is brilliant!
    Simple to use and setup - and very cheap!

    Would be even better with a clipper (2d rectangle) object. This would enable me to use this for long scrolling text, scrolling lists, etc - necessary for more advanced GUI functions!
  5. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    @ChezDoodles: Thank you for your comment. About the clipper, I already add it in the ex2D roadmap, two features are coming up in the future:

    * Scale9Grid
    * Soft clip rect

    So with these two basic function, you can build your own GUI system through ex2D.
  6. p6r

    p6r

    Member

    Joined:
    Nov 6, 2010
    Messages:
    881
    An evaluation version is always fantastic ! Thanks jwu !!!
    And a so low price for all users ! Incredible !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    It's so easy to combine ex2D and the Timeline of Unity3D to create a non-linear path for this horse :



    6R
  7. ChezDoodles

    ChezDoodles

    Member

    Joined:
    Sep 13, 2007
    Messages:
    54
    Fantastic!
    I own EZ-GUI and iGUI (and everything GUI-related on the Unity3D AssetStore) - but I have never really used any of those for production. This is the first GUI extension simple and focused enough to make me feel 100% in control after just a few hours, yet advanced enough that it makes sense to replace my own homegrown GUI...

    Looking forward to the clip rect : )
  8. ayrik

    ayrik

    Member

    Joined:
    Aug 31, 2008
    Messages:
    337
    This is great! Good job on everything. I am really glad to see that you are utilizing the Unity methods of doing things, it really feels like something built right into the engine. We are purchasing this right now, thanks for making such an awesome tool. Also, I am excited to see what your UI system will be like!
  9. nantas

    nantas

    New Member

    Joined:
    Feb 11, 2010
    Messages:
    122
    Good stuff Philippe!

    Looking forward to more! :D
  10. 2Dsprite.com

    2Dsprite.com

    New Member

    Joined:
    Jun 9, 2011
    Messages:
    74
    I am trying the evaluation version before buying, and I absolutely love it... except one problem. It almost doubles the time it takes for me to make atlases, which is too long because of how many atlases I have to make.

    $problem.jpg

    I am trying to build 2048x2048 sprite sheets from 512x512 images (lots of them-- 20-40)

    50% chance Unity will crash on trying to build an Atlas, but after a reload it's usually a success. So it always crashes first time, then doesn't second time I try.

    This is extremely inconvenient, especially when these crashes messing up the atlases to where it still thinks the images are not atlased when I try to animate them (even after a successful atlas build, if it crashes later on a different atlas it can mess it up).

    I am so frustrated, but I love this program.

    I really wish there was a way to automatically create atlases based on images inside a folder.
    If it was, it would be so easy! Even better, if I could get it to create atlases AND animations based on the ending name of _000 to _634, that would be even better. I'd be willing to pay for it if it wasn't too much (I'm sure it would be).
    My naming convention of all my image files are already very organized (_000 to _040 is Idle, _041 is Walk, etc.) and I have to do this for every character, equipment, etc. PitA to have to manually create all the atlases and animations when they will be identical in organized folder and naming convention _###.

    Would it be hard for an amateur programmer to make a script which does what I'm asking?
  11. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello 2Dsprite, I will go check memory problem! Some of my customer report this, too. I think I got a way to solve it.
    For dragging a folder to Atlas Editor, I'm working on it.

    About the naming to animation, I think it is not quite generic so ex2D will not add a solution for it. I can see it is a specific working pipeline in your studio. So my answer is for writing a special script in Editor, it can be done. Aslo I don't think it has any difficulty.
    Last edited: Aug 25, 2011
  12. 2Dsprite.com

    2Dsprite.com

    New Member

    Joined:
    Jun 9, 2011
    Messages:
    74
    Thanks! I notice it does the memory problem when I just browser using the Atlas Animation Clip editors. I don't have to even click anything, if I view the files with either of those two windows open, it kills the memory. So I think it might have to do with all the images being viewed in the editor's window. Hope that helps.

    Thanks for the help.
  13. SoulWind

    SoulWind

    New Member

    Joined:
    Aug 25, 2011
    Messages:
    23
    In fact at the first time you browser a gameobject which attach a sprite component, it seems that ex2D will read all the picture file you add in atlas editor, and store all image in memory.
    So the more atlas you build the more memory you need to store images
  14. nantas

    nantas

    New Member

    Joined:
    Feb 11, 2010
    Messages:
    122
    We are aware of this issue. With the next update (should be pretty soon!) unnecessary textures will be unloaded soon enough to prevent problem.

    Thanks for the feedback!
  15. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Guy i need backup!

    I don't know what is going on, but all my Sprites now are pixelated!? Check this out:

    Before:
    [​IMG]

    And now:
    [​IMG]


    Someone know what is going on?!
  16. nantas

    nantas

    New Member

    Joined:
    Feb 11, 2010
    Messages:
    122
    Hi badawe´╝î

    I'm not sure exactly what cause the problem but you can run the following check:

    1. Open your atlas texture file in Photoshop or other picture viewer tool, see if it looks alright.
    2. Select atlas texture file in Unity project folder, look at the preview of Inspector window. See if the dimension of texture is the same as what you set up in Atlas Editor.
    3. If the atlas texture is fine. Check your camera setting and viewport setting, make sure you have selected the correct camera and viewport size.
    4. Select your sprite in the scene. See if you have enabled UsePixelPerfect and has the scale of the sprite modified? Try to set up the scale to 1,1 and see if it helps.

    If you have gone through all above checks and still got the same result. Please send us a mail: studio@abitgames.com with more details about your scene set up.

    Thanks!
  17. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    1 - Yeah, looks fine on Photoshop!
    2 - Yeah, looks right to: 2048 x 2048!
    3 - My camera its ok to: Is orthographic and size is 384 for the 1024x760 resolution. Works fine untill this.
    4 - Its not UsePixelPerfect and try to change the scale, but don't work too.


    I try the project on iPad and everything looks fine! Only in the Editor and Play looks pixelated. Anyone have this problem too?
  18. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    @2Dsprite.com, @SoulWind.

    Hello all, I have solve the big memory problem. Instead of loading all Atlas in AtlasDB for cache, I use GUID instead. In this way, it only increase memory in editing Atlas and those texture used in the scene.

    I have submitted my fixes to Unity Asset Store, and will available in v1.0.1 b2. I also update the Evaluate version so people who didn't buy the production can also test it.

    You can download the new Evaluation version here

    For more detail about the upgraded version, check the my Change Log

    Enjoy!
  19. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello badawe,

    Can you give me more details, like what is your Texture settings, Render settings in your project. Or if possible, please send me an example project with this problem. That help me a lot.

    Thanks in advance.
  20. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    jwu!

    The only thing seens to work is export the hole project as package and import in a new one =/
  21. 2Dsprite.com

    2Dsprite.com

    New Member

    Joined:
    Jun 9, 2011
    Messages:
    74
    Thank you! I will try ex2D evaluation again before deciding on something else. I really liked it, and if I can figure out how to build things faster, then I definitely want ex2D bc it is my favorite by far.
  22. nantas

    nantas

    New Member

    Joined:
    Feb 11, 2010
    Messages:
    122
    Hi badawe,

    Our artist just encountered with the similar problem. And it turns out that the atlas texture has "generate mip maps" enabled.
    Can you check your atlas texture set up again? And see if there's anything unusual for a 2D sprite game.

    We are still looking from the code side, but if you can provide more information about your texture setting would be great.
  23. p6r

    p6r

    Member

    Joined:
    Nov 6, 2010
    Messages:
    881
    Here is another animation test using ex2D :



    6R
  24. ayrik

    ayrik

    Member

    Joined:
    Aug 31, 2008
    Messages:
    337
    badawe, click on the texture asset and ensure that the "Max Size" field is set to higher than 1024.
  25. 2Dsprite.com

    2Dsprite.com

    New Member

    Joined:
    Jun 9, 2011
    Messages:
    74
    What scripts in ex2D do I need to start with and take a look at to make my own script which takes a set of images and makes them into an atlas and also an animation?
  26. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Guys i update to 1.0.1 after buy, but in my project i get this errors:

    Code (csharp):
    1.  
    2. MissingReferenceException: The object of type 'Texture2D' has been destroyed but you are still trying to access it.
    3. Your script should either check if it is null or you should not destroy the object.
    4. exAtlasDB.UpdateElement (.Element _el) (at Assets/ex2D/Editor/AtlasEditor/exAtlasDB.cs:185)
    5. exAtlasDB.Init () (at Assets/ex2D/Editor/AtlasEditor/exAtlasDB.cs:129)
    6. exAtlasDB.GetElement (UnityEngine.Texture2D _tex) (at Assets/ex2D/Editor/AtlasEditor/exAtlasDB.cs:222)
    7. exSpriteEditor.OnInspectorGUI () (at Assets/ex2D/Editor/ComponentEditors/exSpriteEditor.cs:266)
    8. UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty)
    9. UnityEditor.InspectorWindow.OnGUI ()
    10. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
    11.  

    and this:

    Code (csharp):
    1.  
    2. ArgumentException: Getting control 28's position in a group with only 28 controls when doing Repaint
    3. Aborting
    4. UnityEngine.GUILayoutGroup.GetNext ()
    5. UnityEngine.GUILayoutUtility.DoGetRect (Single minWidth, Single maxWidth, Single minHeight, Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options)
    6. UnityEngine.GUILayoutUtility.GetRect (Single minWidth, Single maxWidth, Single minHeight, Single maxHeight, UnityEngine.GUIStyle style, UnityEngine.GUILayoutOption[] options)
    7. UnityEditor.EditorGUILayout.ColorField (System.String label, Color value, UnityEngine.GUILayoutOption[] options)
    8. exSpriteEditor.OnInspectorGUI () (at Assets/ex2D/Editor/ComponentEditors/exSpriteEditor.cs:306)
    9. UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty)
    10. UnityEditor.InspectorWindow.OnGUI ()
    11. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
    12.  
    13.  


    PS. this issue are resolved by rebuilding all Sprites.


    Anther question is:

    I can make exSpriteAnimClip dynamic? Like if one enemy take a slow damage, i want to make this animation a little more slower, i can do that?
    Last edited: Aug 26, 2011
  27. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Another thing i want ASAP: is

    access to the alpha, and change this!

    can change the color of one material!

    like one enemy has poison, I want to put some blue over then! Any chances?
  28. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Another thing i want to do:

    I Need a lot of animations, and this animations have a lot of frames! So i want to create this dynamic!

    This is what I'm try to do:

    HTML:
    exAtlas objAtlas = DentaduraObj.GetComponent<exSprite>().atlas;
    		
    		biteAnimClip = new exSpriteAnimClip();
    		
    		biteAnimClip.wrapMode 	= WrapMode.Loop;
    		biteAnimClip.length		= 0.4f;
    		biteAnimClip.name		= "Bite";
    		
    		for(int i = 0; i < 4; i++)
    		{
    			string frameName = "dentadura_000"+i;
    			
    			int targetFrame = objAtlas.GetIndexByName(frameName);
    			
    			exSpriteAnimClip.FrameInfo tempFrameInfo = new exSpriteAnimClip.FrameInfo();
    			
    			tempFrameInfo.atlas 		= objAtlas;
    			Debug.Log(objAtlas.name);
    			tempFrameInfo.index 		= targetFrame;
    			tempFrameInfo.length 		= biteAnimClip.length/4;
    			//tempFrameInfo.textureGUID	= tmpSprite.textureGUID;
    			
    			
    			biteAnimClip.frameInfos.Add(tempFrameInfo);
    		}
    		AnimController.defaultAnimation = biteAnimClip;
    		AnimController.animations.Add(biteAnimClip);
    But i can't find this textureGUID? What is this?
  29. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello 2Dspsrite,

    Since you need a script-driven working pipeline for Atlas and Sprite Animation, I adjust the script in Editor to fit your demand, this update will be added in the ex2D - v1.0.1 b3. I'll submit it in next Monday. If you can't wait, please send me an E-mail to ask a quick-fix version.

    I also do some test to make sure the auto pipeline works well in ex2D. By now, it is great! You can see my script below to learn how to use the script to save your time.

    The script will take a path "Assets/_test/PipelineTest", and read the files:

    j_01.png, j_02.png, j_03.png, .... r_01.png, r_02.png, ....

    add them to an atlas named "foobar_01"
    then it will save all j_*.png as "jump" sprite animation clip and save all r_*.png as "run" animation clip.

    Enjoy!

    Code (csharp):
    1.  
    2.  
    3. ///////////////////////////////////////////////////////////////////////////////
    4. // usings
    5. ///////////////////////////////////////////////////////////////////////////////
    6.  
    7. using UnityEngine;
    8. using UnityEditor;
    9. using System.Collections;
    10. using System.IO;
    11.  
    12. ///////////////////////////////////////////////////////////////////////////////
    13. // AutoPipeline
    14. ///////////////////////////////////////////////////////////////////////////////
    15.  
    16. public class AutoPipeline {
    17.  
    18.     // ------------------------------------------------------------------
    19.     // Desc:
    20.     // ------------------------------------------------------------------
    21.  
    22.     [MenuItem("Test/Do Auto Pipeline") ]
    23.     static void DoAutoPipeline () {
    24.         string path = "Assets/_test/PipelineTest";
    25.         CreateAtlas (path);
    26.         CreateAnimClips (path);
    27.     }
    28.  
    29.     // ------------------------------------------------------------------
    30.     // Desc:
    31.     // ------------------------------------------------------------------
    32.  
    33.     static void CreateAtlas ( string _path ) {
    34.         // check if we have the atlas info
    35.         DirectoryInfo dirInfo = new DirectoryInfo( Path.Combine(_path,"atlas") );
    36.         if ( dirInfo.Exists == false ) {
    37.             AssetDatabase.CreateFolder ( _path, "atlas" );
    38.         }
    39.  
    40.         // create the atlas info
    41.         exAtlasInfo atlasInfo = exAtlasInfoUtility.CreateAtlasInfo ( Path.Combine(_path,"atlas"),
    42.                                                                      "foobar_01",
    43.                                                                      256,
    44.                                                                      256 );
    45.  
    46.         // import objects
    47.         Object[] objects = new Object[] {
    48.             // jump
    49.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_01.png" ), typeof(Texture2D) ),
    50.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_02.png" ), typeof(Texture2D) ),
    51.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_03.png" ), typeof(Texture2D) ),
    52.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_04.png" ), typeof(Texture2D) ),
    53.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_05.png" ), typeof(Texture2D) ),
    54.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_06.png" ), typeof(Texture2D) ),
    55.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_07.png" ), typeof(Texture2D) ),
    56.             // run
    57.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_01.png" ), typeof(Texture2D) ),
    58.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_02.png" ), typeof(Texture2D) ),
    59.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_03.png" ), typeof(Texture2D) ),
    60.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_04.png" ), typeof(Texture2D) ),
    61.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_05.png" ), typeof(Texture2D) ),
    62.         };
    63.         atlasInfo.ImportObjects ( objects );
    64.  
    65.         // layout elements
    66.         atlasInfo.allowRotate = false; // I haven't support it
    67.         atlasInfo.algorithm = exAtlasInfo.Algorithm.Tree; // choose tree layout algorithm
    68.         atlasInfo.LayoutElements ();
    69.  
    70.         // build the altas
    71.         exAtlasInfoUtility.Build ( atlasInfo );
    72.     }
    73.  
    74.     // ------------------------------------------------------------------
    75.     // Desc:
    76.     // ------------------------------------------------------------------
    77.  
    78.     static void CreateAnimClips ( string _path ) {
    79.         // check if we have the atlas info
    80.         DirectoryInfo dirInfo = new DirectoryInfo( Path.Combine(_path,"anim") );
    81.         if ( dirInfo.Exists == false ) {
    82.             AssetDatabase.CreateFolder ( _path, "anim" );
    83.         }
    84.         exSpriteAnimClip clip = null;
    85.         Object[] objects = new Object[0];
    86.  
    87.         // create jump animclips
    88.         clip = exSpriteAnimClip.Create ( Path.Combine(_path,"anim"), "jump" );
    89.         // add jump frames
    90.         objects = new Object[] {
    91.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_01.png" ), typeof(Texture2D) ),
    92.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_02.png" ), typeof(Texture2D) ),
    93.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_03.png" ), typeof(Texture2D) ),
    94.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_04.png" ), typeof(Texture2D) ),
    95.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_05.png" ), typeof(Texture2D) ),
    96.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_06.png" ), typeof(Texture2D) ),
    97.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "j_07.png" ), typeof(Texture2D) ),
    98.         };
    99.         exSpriteAnimationUtility.AddFrames( clip, objects );
    100.         exSpriteAnimationUtility.Build(clip);
    101.  
    102.         // create run animclips
    103.         clip = exSpriteAnimClip.Create ( Path.Combine(_path,"anim"), "run" );
    104.         // add run frames
    105.         objects = new Object[] {
    106.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_01.png" ), typeof(Texture2D) ),
    107.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_02.png" ), typeof(Texture2D) ),
    108.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_03.png" ), typeof(Texture2D) ),
    109.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_04.png" ), typeof(Texture2D) ),
    110.             AssetDatabase.LoadAssetAtPath( Path.Combine( _path, "r_05.png" ), typeof(Texture2D) ),
    111.         };
    112.         exSpriteAnimationUtility.AddFrames( clip, objects );
    113.         exSpriteAnimationUtility.Build(clip);
    114.     }
    115. }
    116.  
    117.  
    Last edited: Aug 27, 2011
  30. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello badawe:

    I will put your 3 questions in this post:

    My bad, You should find the .ex2D_AtlasDB and .ex2D_SpriteAnimationDB, click it and in Inspector, first click Sync button, second click the Build All button to finish the update.

    [​IMG]

    In ex2D v1.0.1 b3, I add a version value in these two DB file, so don't worry about it, it will automatically update in the future.

    This is available in the ex2D v1.0.1 b3. I have to explain more about it. You can not access the color of one material since that will lead to two option:

    1. instantiate a new material which will get one more draw call.
    2. change the original material which will make all sprite use this atlas affect by the color.

    exSprite provide the color property, and it is built in vertex, so draw call will not affect by changing it. Based on your description, I guess you want to change color in Unity's Animation Editor. If you see my code, you will find the code similar below:

    Code (csharp):
    1.  
    2.  
    3.     [SerializeField] protected Color color_ = Color.white;
    4.     public Color color {
    5.         get { return color_; }
    6.         set {
    7.             if ( color_ != value ) {
    8.                 color_ = value;
    9.                 updateFlags |= UpdateFlags.Color;
    10.             }
    11.         }
    12.     }
    13.  
    14.  
    Unfortunately, Unity's Animation Editor only animates the value directly not through the get,set function. So it will only change color_ but skip set function and in the runtime you never get the result updated cause updateFlags never changed.

    To solve the problem, I introduce a AnimationHelper component in ex2D v1.0.1 b3. This component will run its Update function, detect the difference of the animatable value inside exSprite. By using it, you just need to toggle on the "Use Animation Helper" in Inspector:

    [​IMG]

    Let me explain more about exSpriteAnimClip. Your code looks all right except at last it added to animations directly. This will not let SpriteAnimation component knows the animation. Because exSpriteAnimClip is an asset, and what SpriteAnimation component used at the end is the exSpriteAnimState (you can treat it as the instance of exSpriteAnimClip). So if you would like to dynamically add an animation, you need to create an exSpriteAnimState, and copies settings from your anim-clip to it. Also you need to add the AnimState to the NameToState table so that your SpriteAnimation component can Play it by name.

    Since its complexity, I also add the function exSpriteAnimatoin::AddAnimation( exSpriteAnimation _animClip ); to help you ease the job. So in your game just call:

    Code (csharp):
    1. AnimController.Add(biteAnimClip);
    and everything should goes fine. I've sent you the quickfix version. And I will submit all these changes in ex2D v1.0.1 b3 in next Monday.

    Attached Files:

    Last edited: Aug 27, 2011
  31. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    jwu thanks a lot for the fast reply and all this new stuff! Some comments!


    - Create Animations Dynamically
    Works like a charm! Perfect ;)

    - About change the color and alpha of my objects!
    What i realy need is change this stuff by code! So for explanation, one of my enemies has slow on it, and i want to change the color of this object a little big, to blue! i what to access my exSprite and change the color to Color.green with a little of alpha, or just change the alpha os my object, understand? I try set one of my objects to "Use animation helper" but he create another material, and if i must to do that in all my enemies gonna be a mess!

    I want to do something like that:
    Code (csharp):
    1.  
    2.  void Update() {
    3. exSprite = myGameObject.GetComponent<exSprite>().color = Color.Lerp(Color.white, Color.black, Time.time);
    4.     }
    5.  
    or:

    Code (csharp):
    1.  
    2.  void Update() {
    3. exSprite = myGameObject.GetComponent<exSprite>().color = Color.greem;
    4.     }
    5.  
    Can we do that?



    BUGS in this version:
    - If you click on Use Animation Helper, you never can't unselect, and User Layer 2D too.
    - When you try to sync the animation atlas if you have one miss or bug Animation, like you still have the anim clip file, but the target png files are missing, you get infinity loop on sync!
    - When you change some stuff in atlas, and update one object with exSprite 2D, sometimes he lost the mesh, you need to go back and set the mesh to none!
    Last edited: Aug 27, 2011
  32. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Yes you can.


    BUGS in this version:

    I test it in my PC, looks good. :(
    May be you can try delete the ex2D folder and reimport the new version since the structure of new version have been changed,

    What do you mean of "sync"? Do you mean Sync the .ex2D_SpriteAnimationDB file?

    Can you be more specific, give me a step by step way to reproduce it? Thanks very much!
  33. rbsn

    rbsn

    New Member

    Joined:
    Aug 13, 2011
    Messages:
    4
    Hey jwu, is there a function to play and stop on specific frame on ExSpriteAnimation via script?

    Thanks,
  34. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi rbsn, I'm not sure if this is what you want:

    Code (csharp):
    1. // for example you have 10 frames here, and you want to start from frame 2
    2. exSpriteAnimation spAnim = GetComponent<exSpriteAnimation>();
    3. exSpriteAnimState runState = spAnim.GetAnimation("run");
    4. runState.time = runState.frameTimes[2];
    5. spAnim.Play("run");
    6.  
    7. ....
    8. ....
    9. ....
    10.  
    11. // if you would like to end at frame 8, just check your script in other place like:
    12. exSpriteAnimation spAnim = GetComponent<exSpriteAnimation>();
    13. exSpriteAnimState runState = spAnim.GetAnimation("run");
    14. if ( runState.time >= runState.frameTimes[8] ) {
    15.     spAnim.Stop();
    16. }
    17.  
  35. rbsn

    rbsn

    New Member

    Joined:
    Aug 13, 2011
    Messages:
    4
    Hey jwu, thanks for quick reply :)

    I can do what i need with ur example, but not in the best way...
    I need a function kind of goToAndPlay(frame) goToAndStop(frame).
    It will be a great improvement in ex2d.

    Thanks again!
  36. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi rbsn,

    I'm not got it.

    - What is the type of frame in goToAndPlay(frame) and goToAndStop(frame) ?
    - Is it a int represent the index of frames in SpriteAnimClip ?
    - What will goToAndPlay (frame) do ? Will it go to the "frame" and play start from it ?
    - What will goToAndStop (frame) do ? Can you give me more details of the function ?

    So can you give me an example or a scenario help me understand your demands ?
    Thanks in advance.
  37. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    @jwt i think what @rbsn is trying to say is something like that:


    I have one Game Object with exSprite and have a lot of exSpriteAnimClip inside one exSpriteAnimation some function like:

    myExSprite.exSpriteAnimation.StopAtFrameOfAnimation(1, "biteAnimation");

    This make my exSprite find the exSpriteAnimclip of name "biteAnimation" and set like setSprite do.

    I know we can do that using setSprite, but something to easily this process gonna be great.
  38. 2Dsprite.com

    2Dsprite.com

    New Member

    Joined:
    Jun 9, 2011
    Messages:
    74
    Wow, that is awesome!

    I will definitely go with ex2D then :)

    Amazing fast response, I can't believe the quality of your service!
  39. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    @rbsn, @badawe,

    I add two functions to work this out:

    Code (csharp):
    1. exSpriteAnimation::Play( string _name, int _index );
    This function will play sprite animation by the _name, and start from the frame _index.

    Code (csharp):
    1. exSpriteAnimation::SetFrame( string _name, int _index )
    This function will take the Frame _index in Sprite Animation Clip _name, and set it as a static sprite in exSprite. (will not play animation)

    I've submitted the ex2D v1.1.0, and will be available at Unity3D Asset Store soon.

    Here is the change list in v1.1.0. I'm working on the documentation.

    The biggest feature in 1.1.0 is the Soft-Clip Rect. With this component, you can do rect clip on any child Sprite, Sprite Font in the scene. It will help user create there GUI object such as scroll view!

    I'll let you known once it is on the Store.
  40. p6r

    p6r

    Member

    Joined:
    Nov 6, 2010
    Messages:
    881
    WOW ! Great new functions...
    Thanks jwu !!!

    6R
  41. bryantdrewjones

    bryantdrewjones

    Member

    Joined:
    Aug 29, 2011
    Messages:
    111
    Hey there :)

    What is the best way to deal with multiple resolutions using ex2D? I'm trying to target iPhone 3GS, iPhone 4, iPad, and Android phones, but there isn't a clear workflow for swapping low res sprites with high res sprites depending on the device.

    How are you all handling this problem?

    Thanks for the help :)
  42. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello bdjones,

    The current version of ex2D doesn't provide any solution on different resolution. However, we are start researching this in our new Game.
    My idea is about to aim on one device first, once we finish the game (almost), we can start creating resource such as textures in other resolution. This time we don't want to recreate our Sprite Animation, Skeleton Animation, Atlas and GUI position settings. So we just create a folder that contains the high-res textures or resource and have the same Hierarchy as the resource in our first target device. Then we run the script to get the settings of Animatons, Atlas from low-res resources and create new one in our high-res resource folder, and saves them properly.

    For example, suppose we aim to create our game in iphone 3 first. We have a folder named ip3, with run_01.png ... run_10.png textures. Then we create our Atlas, Sprite Animation using these textures. The resource in project hierarchy may looks like:

    /ip3/
    +/run_01.png
    +/run_02.png
    +...
    +/run_10.png
    +/run_atlas.asset
    +/run_atlas.png
    +/run_atlas.mat
    +/run_atlas - EditorInfo.asset
    +/run_animatoin.asset

    And now we finish our game in iphone3, and want to start a iPad version. We remake run_01.png ...... run_10.png as HD textures, and we create a folder like this:

    /ipad/
    +/run_01.png
    +/run_02.png
    +...
    +/run_10.png

    Then we run the cross-platform process scripts, then ex2D will generate the rest of the things by reference the new HD textures:

    +/run_atlas.asset
    +/run_atlas.png
    +/run_atlas.mat
    +/run_atlas - EditorInfo.asset
    +/run_animatoin.asset

    That's all what I intend to do in the next few months.
    Last edited: Aug 30, 2011
  43. Seokho

    Seokho

    New Member

    Joined:
    Aug 31, 2011
    Messages:
    23
    Hello.
    I have some questions.

    1. What is different between v1.1.0($25) vesion and evaluation version (able to download at homepage).

    2. If I buy it ($25), can I update ex2D forever without charging?

    3. I want to make 2D game in Unity3D at XZ plane. I tried to move a sprite, but couldn't move at "Z-line" without deactivate "Use Layer2D". If "Use Layer2D" is false, could not use a layer?
    (I'm using a evaluation ex2D now)

    Expect quick reply :-D
    Last edited: Aug 31, 2011
  44. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello Seokho,

    Let me answer your question:

    The Evaluate version is an old beta version that just explain the workflow of ex2D. It didn't contains bug fixes immediately. And will not contain new features such as Sprite Font, Soft Clip, Path Sprite, and so on.

    ex2D basic framework will only sales at $25. If you buy it from Unity3D Asset Store, you definitely have the benefit in updating it for free.

    The ex2D Basic (25$) is design to provide user a basic but essential tools to make a 2D sprite game. We carefully design the framework so user can extends other 2D editor based on it.

    We also use ex2D basic to develop our new tools such as TileMap Editor, 2D Skeleton Editor, GUI Editor, and we do have a plan to sale these tools separately in Asset Store as Add-On.

    The plan of add-on doesn't mean we will not add new features in ex2D Basic. Like I said, our tool set is design and created to insert minimal stuff into your project. A big and common problem about middleware is that sometimes they try to do too much and includes a lot of classes that you may never need. ex2D only does things you can't get around in Unity without middleware.

    An example is the feature we provide in v1.1.0, the SoftClip object, which can help you build your own GUI system. And we also use it in our up coming GUI Editor. So this is an essential feature for user to create their own GUI editor but also provide us a chance to build a commercial solution for customer.

    This is a bug I doubt, since I test Layer2D in XY plane a lot, and forget to calculate it in other Plane. I will fix this, and I will upgrade the Evaluate version and notify you.
    Last edited: Aug 31, 2011
  45. GrimReio

    GrimReio

    New Member

    Joined:
    Jan 18, 2011
    Messages:
    3
    Hello, jwu.
    This is simply best unity sprite plugin. Great work.

    Don't know if it exists in paid version, but I want to submit a little bug.
    I added sprite component to brand new object, dragged texture on it w/o creating atlas and saved gameobject as prefab. On instantiation in play mode mesh is missing.
    Last edited: Aug 31, 2011
  46. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hello reio,

    In the evaluation version, there have a bug, if the sprite become prefab and use a texture not in exAtlas, it will not build mesh. If you not sure a texture is in Atlas or not, check the inspector of the exSprite, and see if Atlas is None and Index is -1 which means the texture is not build in atlas.

    I have fix this bug in v1.1.1, and will submit to asset store this week.

    I will also upgrade the Evaluation version these two days. I'll let you know when I fix it. Before that, just let the sprite reference textures that already in Atlas.
    Last edited: Aug 31, 2011
  47. Seokho

    Seokho

    New Member

    Joined:
    Aug 31, 2011
    Messages:
    23
    I hope it will soon : )

    I have another question.
    Flow #1.
    I ray to sprite GameObject and get hitInfo (RayInfo).
    Flow #2.
    And then I tried to get color information of texture whether alpha or RGB value.
    But ex2D seems to save sprite information in RECT.
    I got atlas [exSprite.index].coords and tried to convert XY coordination with UVs (in hitInfo).
    Flow #3.
    The rect information is not exactly same with atlas texture which was built.

    Can I get sprite's INT coord information in atlas texture???
  48. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    Hi Seokho:

    The atlas [exSprite.index].coords saves the UVs coordination of the sprite in atlas texture. Its range is from [0,1]. So if you would like to get INT coord, just multiply it with the width/height of the texture.

    int x = atlas.texture.width * atlas[index].x
    int y = atlas.texture.height * atlas[index].y

    Is this what you want ?
  49. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    jwt anothing thigs gonna be useful!

    I want to delete some files of one Atlas, but i can't find it in atlas, so i want something like that:

    When i select the file in Project, the file select on Atlas automatically!


    We can have something like that?
  50. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    When i use some sprites to make our tile!!!!

    [​IMG]

    We cannot solve this problem, this 1 pixel line!! Anyone have anything to solve this?