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

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

  1. Seokho

    Seokho

    New Member

    Joined:
    Aug 31, 2011
    Messages:
    23
    Hello, jwu and nantas.

    Our company finally buy the ex2D tool. : - D
    I hope this will have more benefits both your company and ours.

    When I import the ex2D v1.1.3, there's a readme file.
    But readme file introduce v1.0.
    Can U update this? I want to know what version of ex2D I using.

    Sincerly.


    ------------------------------------------------------------------------------------------------------------------------
    At a "window - ex2D - About" Window shows a correct version.
    I've found now. : )
    ------------------------------------------------------------------------------------------------------------------------
    I asked before, "Is there a solution when I make a game in different resolution display?"
    v1.1.3 has a solution about this?
    If it has, where can I find?
     
    Last edited: Sep 21, 2011
  2. Wu Jie

    Wu Jie

    New Member

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

    Yes there is an about window, and thanks for your reminds, I do forget update readme. T_T.

    In current version of ex2D, there is no multi-resolution solution. We are discussing and trying different approach, so it is still in a very early stage for this feature.

    I'm now test this in a branch version, the solution is make multiple textures group in one assets, and when assign different resolution, ex2D will choose the right texture from this group. And other editors such as Atlas, Sprite Animation will cooperate with it, and help you build the asset in different resolution.
     
  3. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Guys, after update my Unity3D to 3.4.1!

    My project don't open anymore, and after some test, when I remove the ex2D folder, and the project open again, but i can't solve this, and even if i reinstall the old unity, i can't open my project anymore!

    Do you guys have any idea of what is going on?
     
  4. Wu Jie

    Wu Jie

    New Member

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

    Try to remove .ex2D_AtlasDB and .ex2D_SpriteAnimationDB and reopen the project. If you still have problem, would you mind to send me the package and I will do a full test.
     
  5. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    I reinstall unity 3.4 and reimport the ex2D and everything back on track!

    But unity are really freak me out with this bugs!
     
  6. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    But badawe, we are using Unity 3.4.1, and nothing goes wrong :(. And some of my customer report me that some of their weird crashes have been fixed in 3.4.1.
     
  7. AirCooled

    AirCooled

    New Member

    Joined:
    Aug 31, 2011
    Messages:
    6
    jwu - thanks for this great add-on! Ex2D, and your excellent support, gets five stars from me!
     
  8. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Hummm, I'll try a clean install and post here the feedback!
     
  9. bryantdrewjones

    bryantdrewjones

    Member

    Joined:
    Aug 29, 2011
    Messages:
    111
    Hey jwu,

    I'm getting 11 draw calls in my scene and I don't know where they're all coming from. I have 14 sprite objects in the scene. All of the sprites are atlased and there are 4 atlases in total. Depending on where I position the camera I get anywhere from 6-11 draw calls. Shouldn't it only be 4 draw calls -- one for each material in the scene? I'm not doing any scaling, rotation, or tinting on the sprites.

    Thanks! :)
     
  10. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Guys, i want to make something, but in unity3D / Ex2D i don't have idea of how achieve this.

    I Have, this 2 images:

    [​IMG]

    and this:

    [​IMG]

    I Want to make a cooldown like a pizza chart!

    So when user click over it the pie rotate make on mask, and showing the color image again, like that:

    [​IMG]

    Anyone know how to achieve that?
     
  11. reissgrant

    reissgrant

    Member

    Joined:
    Aug 20, 2009
    Messages:
    727
    Do you have any lights in your scene? That will add draw calls for each object.

    If not, you can always press play, and start deselecting objects to see how the draw calls are affected.

    @jwu This plugin looks great! Nice work! Definitely getting this.
     
  12. Seokho

    Seokho

    New Member

    Joined:
    Aug 31, 2011
    Messages:
    23
    Hello.
    I'm crazying about some bugs when using "Prefab"!

    [First Bug]
    1. In Hierarchy window, "create -> ex2d -> sprite object".
    2. Select a texture and check the "Pixel Perfect" true.
    3. Drag it to Project window and make a prefab.
    4. Then Debug window shows a error!
    [Second Bug]
    1. In Hierarchy window, "create -> ex2d -> sprite object".
    2. Select a texture and collision type to mesh.
    3. Drag it to Project window and make a prefab.
    -> The prefab loses a Mesh in the Mesh Filter Component and Mesh Collider Component.
    4. Drag a prefab to Hierarchy window. So make a some instance of the prefab.
    5. These have a mesh info in the Mesh Filter Component but still lose a mesh info in the Mesh Collider.
    -> So I can't cast a ray to these (instances of the prefab)
    -> I reported this bug to you and read your reply it will be fixed at 1.1.2. But ex2D has still "Mesh Collider Bug".

    [Wondering]
    1. In Hierarchy window, "create -> ex2d -> sprite object".
    2. Select a texture and check the "Pixel Perfect" true.
    -> Then object is smaller than before.
    3. Drag it to Project window and make a prefab. Delete #2's object.
    4. Change the prefab's collision type to Box. (Don't check the "Use Collision Helper"
    5-1. Drag the prefab to Hierarchy window, and Play the Scene.
    -> Then Box collider bigger than sprite object's size. I think the box collider still has a older size when I use "Pixel perfect" before.
    5-2. In the Inspector window, I check "Use Collision Helper".Then it appears a error.

    I think it has more bugs than evaluation version I used.
    And it looks like has not been tested when using a prefab feature.
    Can you check these bugs out?
     
  13. Wu Jie

    Wu Jie

    New Member

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

    I will write an article to explain this. I'll PM you once i finished. Basically, it is because transparent object are rendered by order of the depth. If you have two different material, and one is rendered in the middle of the others, the batch will be failed.

    For example, if you have A, B, C three game object, A, C use atlas1, B use atlas2. When you draw A, B, C in depth 1, 2, 3, then the B will break up the batch of A, C since the transparent object needs sorting. So keep them in one material is a good idea.

    Another tips is use VertexColor shader for those non-transparent object. They will not break up the batches.
     
  14. Seokho

    Seokho

    New Member

    Joined:
    Aug 31, 2011
    Messages:
    23
    Additional Bug!

    I asked before about a bug when making the assetbundle using a prefab.
    So I just "Use Pixel Perfect" to false and make the assetbundle.

    This worked before when I use a "Evaluation Version EX2D".

    But v1.1.3 does not work!
    I can't build the assetbundle anymore ;a;

    I'm using both line of code.
    I can't not understand, version up make the ex2D worse...
     
  15. Wu Jie

    Wu Jie

    New Member

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

    What you need to do is similar like this:

    http://unknownerror.net/2011-05/284...evelopment-tip-skills-cooling-1-cooldown.html

    Hope this help you.
     
    Last edited: Sep 22, 2011
  16. Wu Jie

    Wu Jie

    New Member

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

    I just fix this problem yesterday. I have PM you. Check the note.
     
  17. Seokho

    Seokho

    New Member

    Joined:
    Aug 31, 2011
    Messages:
    23
    I recieved your email and replied.
    Did you read my email?

    I should work using evaluation version ex2D until release new versioni which has fixed bugs.T_T
     
  18. Wu Jie

    Wu Jie

    New Member

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

    I've solve the problem and sent you a daily fixed version. We will make a new update to asset store for this fixes. Enjoy!
     
  19. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Yeah, is something like that! But i don't have idea of how do some Mask with ex2D!
     
  20. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Can i have the trim size? And using that?

    Like that:

    This must have some Rect of the Atlas, and are using this right?

    If i change the height of this, i can't get one fake mask working right?
     
  21. steinbitglis

    steinbitglis

    Member

    Joined:
    Sep 22, 2011
    Messages:
    49
    Hi there,
    there seems to be a bug with the texture offset mechanism.

    What happens is that the offset is not moved if two consecutive frames have the exact same dimensions. This breaks a random selection of animations (those with equal dimensions, but different offset of two consecutive frames).

    The attachment shows an animation where the offset is ignored between frames 1-2 and 6-7

    View attachment $Test.zip

    I have not yet got the paid version, but fix this issue, and you might get another customer.
     
  22. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    Looks like what I need is:

    Code (csharp):
    1. .GetComponent<exSprite>().boundingRect
    But i can't change this in real time, any change this?
     
  23. Wu Jie

    Wu Jie

    New Member

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

    It do have a bug relate with texture offset and been fixed in v1.1.3. ----- "Fix sprite animation not update vertex when the two frame have the same width and height but use texture offset"

    But when I download your package, I'm not sure what is the exactly problem. I saw the raw data where 01.png and 02.png have different place in the picture. And when this two image imported and animated with Use Texture Offset enabled, it does the same result as the original.

    So what is the result you expect when doing this animation? Thanks in advance, and looking forward to see your feedback.
     
  24. Wu Jie

    Wu Jie

    New Member

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

    The boundingRect can not be changed directly. If u want to do some clip to the exSprite. Maybe exPlane.clipInfo is a better choice. :)
     
  25. steinbitglis

    steinbitglis

    Member

    Joined:
    Sep 22, 2011
    Messages:
    49
    Well, then it might be that you have fixed the bug. What happens in my game is that frame 1 and 2 are the same, but they're not supposed to, they're supposed to have different offset.

    I think I have the latest evaluation version, but I'm not sure if it's v1.1.3 ?
     
  26. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277

    But how i can get the Height? To change this dynamically? I try this:

    Code (csharp):
    1. myGameObject.GetComponent<exSprite>().clipInfo.bottom;
    and this:

    Code (csharp):
    1. myGameObject.GetComponent<exPlane>().clipInfo.bottom;

    But both of them, return 0!
     
  27. Wu Jie

    Wu Jie

    New Member

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

    Have you enable the "Use Texture Offset" in the exSprite Inspector of the animated sprite ? It is right below the anchor settings. Make sure you done this.
     
  28. steinbitglis

    steinbitglis

    Member

    Joined:
    Sep 22, 2011
    Messages:
    49
    Yes, of this I'm sure. The offset is changing between frames 2-3-4-5-6.
     
  29. steinbitglis

    steinbitglis

    Member

    Joined:
    Sep 22, 2011
    Messages:
    49
    How do I check which version I'm using? I wouldn't expect the latest evaluation version to be the same as the latest commercial version, but if it is, the bug is still present.
     
  30. Wu Jie

    Wu Jie

    New Member

    Joined:
    Sep 20, 2010
    Messages:
    704
    If you doing the clipping by yourself, that means you are full-control the sprite. So you need to put customSize = true, and then control the width and height manually. Just like this:

    Code (csharp):
    1.  
    2. sprite.customSize = true;
    3. sprite.height = ??;
    4.  
    After that, you are free to change the clipInfo to make your texture fit the clip. The clipInfo is a structure records the clip percentage of each edge. For example, clipInfo.left = 0.5, means the left edge is half-clipped. So suppose your original sprite's height is 100, and u want to clip it to 70. U can write code as:

    Code (csharp):
    1.  
    2. sprite.customSize = true;
    3. sprite.height = 70;
    4.  
    5. ClipInfo newClip = new ClipInfo();
    6. newClip.clipped = true;
    7. newClip.top = 0.3f;
    8. sprite.clipInfo = newClip;
    9.  
     
  31. steinbitglis

    steinbitglis

    Member

    Joined:
    Sep 22, 2011
    Messages:
    49
    Nevermind, I was using version 1.1.2
    Make sure you update the evaluation version that is available at your site.
     
    Last edited: Sep 22, 2011
  32. Wu Jie

    Wu Jie

    New Member

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

    I have PM you for this issue. Please check the message.
     
  33. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    Hi badawe, I will do some test when I got back home. Will get back to you soon.
     
  34. badawe

    badawe

    New Member

    Joined:
    Jan 17, 2011
    Messages:
    277
    nantas and jwu!

    I can do like jwu said, but its a little confuse!

    Gonna be a good addition to ex2D some Maks function, what you guys think?
     
  35. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    Sorry I'm not too familiar with the clipping method jwu mentioned :p

    But the effect you want to achieve is totally doable with the help of a "Depth Mask" shader. Give huge props to pixelplacement (the author of iTween). What you need is a simple shader provided on his website: Masking in Unity

    The shader will hide everything behind it. So you need to have two camera with different culling mask setting. One camera renders mask plane and the sprite that needs to be masked. The other camera renders everything else.

    There's already an example provided with the blog post. And I tried it myself with the exact textures you posted. I will PM you the project I modified so you can see the end result.

    Later I may make a quick video tutorial to explain it to other people that interested.
    (although this kind of masking is the same for any Unity project, not really related to ex2D lol)

    Have fun.
     
    Last edited: Sep 22, 2011
  36. Dymitrix

    Dymitrix

    New Member

    Joined:
    Sep 16, 2011
    Messages:
    1
    I recently purchased ex2D, and I have to say the tool is great. I wish I had known about it before I got SM2 last month. I have one question... is there a way to offset particular frames within an animation clip? For instance I have A.png and B.png wich are trimmed of white space before importing into unity. The width of the two png are not the same because the sprite has a piece of clothing that extends from the body which animates. The animation fluctuates the width. I could re-size the two png to equal widths then position the sprite image within them accordingly, but I have a lot of frames to do this to. If I can perform the task within ex2D that would be great. Thanks.
     
  37. Wu Jie

    Wu Jie

    New Member

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

    I think you can do this by enable the "Use Texture Offset" in the exSprite inspector. And in your picture drawing tool, make sure every single frame of your character animation are in the same size picture, define your horizontal line and draw them with your offset. After that when u import these pictures to atlas/sprite animation editor, they will trimmed (so don't worry about size) but still calculate the anchor by the original width and height (that is what Use Texture Offset do to u, disable it will calculate anchor by the trimmed width and height, which make your character animation shaking).
     
  38. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    I've done a tiny tutorial yesterday. About how to do a skill cooldown effect with animated masking technique, check the video here:

     
    Last edited: Sep 23, 2011
  39. bryantdrewjones

    bryantdrewjones

    Member

    Joined:
    Aug 29, 2011
    Messages:
    111
    Oh dear :-\ Is this problem specific to ex2D? I tried recreating the scene using planes built in Maya and the Unlit/Transparent shader. That kept my draw calls down at 4, even though I have plenty of transparent objects in the scene.

    The textures are too big to all be kept in one material, and they all need transparency. Is there anything else I can do with ex2D? :-\

    Thanks for the help, jwu!
     
  40. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    Hi bdjones, I did some test with "Unlit/Transparent" shader but it doesn't give me batched result, even without ex2D sprites.
    Could you confirm that you are using "Unlit/Transparent" shader not "Unlit/Transparent Cutout"? Since the first one uses Alpha Blend and the second one uses Alpha Testing to determine the render order.

    I think any shader using Alpha Blend will cause batching fail if you sandwich the material with another one. This is how Unity handles the render. If you don't want to change the sprite Z position to prevent the "sandwiching", you can use any shader with "Cutout" to get the batch going again. But it may cause performance issue on mobile devices.
     
  41. bryantdrewjones

    bryantdrewjones

    Member

    Joined:
    Aug 29, 2011
    Messages:
    111
    Hmm...I think I understand why I'm getting the lower draw calls when I piece together the scene in Maya. I have 4 layers in my environment, and they're all long strips that take up multiple screens. When I constructed the scene in ex2D, I created several sprite objects per layer and tiled them together to create my long strips. Each layer had about 5 or 6 sprite objects, so there were 20+ sprite objects in total.

    In Maya, however, each layer is a single plane with subdivided sections. Then I UV mapped each subdivision to the same area on my texture atlases. When I imported the whole scene into Unity, I only had 4 game objects to deal with. I am using the Unlit/Transparent for my 4 texture atlases (not the Transparent Cutout...it doesn't deal with transparent edges well). But it seems the significant difference between these two approaches is the number of objects in the scene.

    I'm guessing there's not a way within ex2D to "combine" sprite objects?

    I hope that all made sense :-\
     
  42. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    Hi bdjones, Sorry about second guessing your word ;p

    ex2D doesn't "combine" sprite objects like maya exporting staticmesh. ex2D only combine texture so many sprite objects can use the same material. That's the requirement for Unity to do its dynamic batching job. If the objects share the same material can't be batched, then usually it's because there're object with another material gets in between.

    Let's get this part straight out. I made a quick screenshot to mimic the ideal situation:

    [​IMG]

    In this picture I have 3 layers of objects. Each layer has its own material. In an ideal world to make the batching work, you have to make sure the objects in different layers are all within their respective Z position range. It's ok to have objects on top of each other in a layer, just don't let object in another layer get in between.

    If I go nuts and mix up the layers like this:

    [​IMG]

    Then I get 6 drawcalls, since Unity can't batch two object if there's another object with another material in between.

    Could you check your scene from other angle and see if there're layers mix up with each other? Thanks!
     
  43. bryantdrewjones

    bryantdrewjones

    Member

    Joined:
    Aug 29, 2011
    Messages:
    111
    All right, I tweaked my atlases a bit. Now each layer has its own atlas (before everything was mixed across all the atlases). There are 5 atlases in total (the layer at the very back is composed of 2 atlases).

    Here's what my scene looks like and the number of draw calls I'm getting on average:

    [​IMG]
    http://twitpic.com/6pg7rc

    Shouldn't I only be seeing 5 draw calls now instead of 9?

    Edit: Sorry, I should explain what you're seeing. The layer at the far back is composed of 4 sprite objects and 2 atlases. The two middle layers have 3 sprite objects and 1 atlas each. The foreground is made up of 4 sprite objects and 1 atlas.
     
    Last edited: Sep 23, 2011
  44. Wu Jie

    Wu Jie

    New Member

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

    Hints

    1. All sprite object must not keep Transform.Scale = (1,1,1). DO NOT touch it. Use exSprite.Scale instead. Because if Transform.Scale is not equal to 1,1,1. Unity will not add the object to batch

    2. Camera NearClipPlane must larger than 100. I still seek the reason, but I just found this two days ago


    --------------------------------------

    Would you mind to send me this package so that I can test it in my PC. My E-Mail: KarasAya@gmail.com .
    The draw call in unity is not just affect by material, but also depends on how much sprites you are rendering. So even if your objects are in 1 atlas, when you create lots of them, they still need to break up into several small batches. Anyway, I hope I can test this in my PC so see your feedback :)

    BTW: I'm going to do a static batch feature if the all background object u create will not moved in the game.
     
    Last edited: Sep 24, 2011
  45. bryantdrewjones

    bryantdrewjones

    Member

    Joined:
    Aug 29, 2011
    Messages:
    111
    Hi jwu,

    I just sent you an email with my project file. Thanks for looking into this!
     
  46. shinriyo_twitter

    shinriyo_twitter

    Member

    Joined:
    Aug 12, 2011
    Messages:
    325
    hello jwu

    Is it safe to overwrite new ex2d to old project developed by old one?


    And I have questions.

    does it make mixing animation like megamn's charging?

    ex)

    Animation A
    A1, A2, A3, A4 ....

    Animation B
    B1, B2, B3, B4 ...

    Animation C
    C1, C2, C3, C4 ....

    result I hope
    A1, B2, C3, A4 ....


    And can the ex2d create blink animation?
     
  47. Wu Jie

    Wu Jie

    New Member

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

    The install and upgrade ex2D can be found in this documentation: http://www.ex-dev.com/ex2d/wiki/doku.php?id=manual:install, if something need to change when upgrading, we will point out in this page. So far, it is safe to upgrade if you start from v1.1.1.

    :( I hope I can understand the question :( . How can u generate a result A1,B2,C3,A4 when u have three different animation ? How they play together ? Can you explain it more clear may be better if u have pictures for this. Thanks in advance.


    The blink animation can be done by using animation helper. and use Animation Clip working with it. The "08 - demo_sprite_animation_helper.unity" scene shows how to doing blink by Unity's Animation Clip and Use Animation Helper ON in inspector.
     
  48. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    Do you mean you want to have 3 different sets of running animation and each has a different outfit color? Then you want mix them up in a single running animation when your hero is charging up or has power up?

    I think you can try the mixing with Play(string_name, int_index) and GetCurFrameInfo ().

    Also you can try to switch the material for your character to have different effect blinking, but it will mess up your dynamic batching and cause performance issue.
     
  49. duke

    duke

    Member

    Joined:
    Jan 10, 2007
    Messages:
    748
    How's the GUI component of this going?
     
  50. nantas

    nantas

    Member

    Joined:
    Feb 11, 2010
    Messages:
    124
    It will be released in ex2D 1.2.0, scalable GUI panel that can be batched with any ex2D sprite!

    [​IMG]

    [​IMG]