Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

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

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

  1. resakosix

    resakosix

    Joined:
    Sep 26, 2012
    Posts:
    5
    Hello,

    i'm thinking about buy this asset but have two doubts:

    Is there any difference between buying ex2D in the asset store or in the plugin page? Are both updated equally?
    Will this license allow me to upgrade to 2.0 release or will it be launched as a different asset?

    Thanks!
     
    Last edited: Sep 26, 2012
  2. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi resakosix,

    There is a little different between buying ex2D in asset store and our web site. In asset store, you can freely upgrade ex2D through Unity's Asset Store application. In our website, you have to download from the link address we provide you, and the link address have an expired time, and you need to send E-Mail to request second time download if you expired.

    If the product release new version, we will send E-Mail to all client so don't worry about missing updates.

    Both address are free for upgrade the product and it is free to upgrade to 2.0 when it released.

    Regards,
    Wu
     
  3. soulburner

    soulburner

    Joined:
    Mar 25, 2012
    Posts:
    167
    Btw, I've posted the script for text-wrap some pages ago that I'm using in my current project.

    Someone can find it usefull too.
     
  4. nia1701

    nia1701

    Joined:
    Jun 8, 2012
    Posts:
    74
    Hi Wu Jie,
    I notice that you already calculate the dimensions of a line of text in the editor when I hit the sync button next to Collision Type. Is it possible to either get the code you use to calculate that collision box size OR manually in code call the sync button to resize that collider? Thanks!

    **NEVER MIND I see thats what the collisionhelper does. I don't know how I missed that!
     
    Last edited: Sep 27, 2012
  5. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Cool man, any way, you can read the Runtime Source from https://github.com/jwu/ex2D_Runtime
     
  6. F

    F

    Joined:
    Sep 28, 2012
    Posts:
    13
    Hi Jwu,
    There have several clips in folder,named like 'clip1','clip2'...
    and I want to choose clip by parameter in the component 'Start' function, the code is like:
    Code (csharp):
    1.  
    2. GetComponent<exSpriteAnimation>().defaultAnimation = (exSpriteAnimClip)Resources.Load("clip" + ID);
    3.  
    and the 'Play Automatically' is True.
    but nothing will be displayed, until I open the 'Ex Sprite Animation' component node in Unity Inspector window while running preview, first frame appeared without playing.

    How should it work?
     
  7. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi F,

    You can't setup defaultAnimation at Start function. Cause the sprite animation play the default animation at Start function, too. So you don't know which function will be first called. Basically you should use exSpriteAnimation.AddAnimation add the clip in the runtime and Play the one you want.

    The defaultAnimation is designed for preset in Editor, not too much use when you in the Runtime.
     
  8. F

    F

    Joined:
    Sep 28, 2012
    Posts:
    13
    HI,
    I tried that way earlier,now it's worked because there was another reason, I added two or more clips with same name,please tell me how to play the exact clip which I want to, if I renamed them by 'clip1.name="NewName"' ,they will change name in file permanently! That made me so sad.
    Do you have any further suggest?
    Thanks.

    F
     
  9. Atrus_Madhatter

    Atrus_Madhatter

    Joined:
    Sep 30, 2012
    Posts:
    4
    Hi,
    Is there a way to make Object with sprite follow mouse? And is it possible to change sprite using code?

    Thanks
     
    Last edited: Sep 30, 2012
  10. Lukas H

    Lukas H

    Joined:
    Jan 16, 2009
    Posts:
    394
    Hi

    I'm wondering, how should ex2D react to texture updates?

    At the moment I'm having troubles with this which result in a terrible, non-Unity workflow. First the problem: when I change a texture with, say, changed width and height. Unity reimports it like always, I go to the exAtlasEditor and in the atlas I see it change but I have to build the atlas to get the changes. Thats fine but the build button is greyed out because the system thinks nothing has changed. So I change the atlas size back and forth to force at change. This is quite annoying. Next I get one of the two situations: (1) I see the new atlas being applied to the scene but the geometry isn't updated so when the texture has increased in size, in the scene its still the old size. (2) all the textures using the atlas disappear in the scene. I have to manually click every gameobject and then it pops in back as I click/select the gameobject.

    Both situations are holding me back in my workflow. Is there something I am doing wrong? Have I encountered a bug?
    Any help would be appreciated as it cost me a lot of time currently.
     
    Last edited: Oct 1, 2012
  11. funshark

    funshark

    Joined:
    Mar 24, 2009
    Posts:
    225

    You're not alone, I have the same issue and i think everyone has.
    But I'm not running the same steps as you to resolve the situation. :)

    Indeed, I think there is room for improvement to the workflow side of ex2D. ( I, also, lost some precious time to resolve these kind of issues :) )
    I have already assigned a bug about this btw.
     
  12. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi F,

    Sorry for the late reply, I'm just back from vacation.
    You can use exSpriteAnimation.AddAnimatoin ( string _name, exSpriteAnimClip _animClip ) function add your animation clip. This function allow you add animation by different name in runtime. But you can preset the name in editor.
     
  13. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi Atrus,

    Yes, you can follow mouse by Unity function. Just use Camera.ScreenToWorld ( Input.mousePosition ) to get the world position of the mouse, and try to setup the position in sprite's transform.

    And you can change the sprite texture by use exSprite.SetSprite(); function
     
  14. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi Lukas H and funshark,

    I known the problem and try to solve the problem by a different structure of the code. Basically I'm changing the work flow which will avoid the rebuild of the scene and make the texture height and width change relate to only texture and sprite and will protect the result until they've been imported and have been built to atlas successfully. These changes still under develop hope you can understand.
     
  15. mkandersson

    mkandersson

    Joined:
    Oct 5, 2012
    Posts:
    21
    Hello. I'm having a bit of problem and I don't know what's causing this. I've created this modular set of ceiling, wall and floor pieces and when I align them next to each other I get these flickering lines. They are not in the texture and it doesn't matter if I take the next section and pull it half way over the other they still appear.
    Image http://postimage.org/image/5ugqewqij/

    Any help would be greatly appreciated! Thanks
     
  16. moopi

    moopi

    Joined:
    Apr 24, 2012
    Posts:
    39
    Hi!

    Is it possible to assign different shaders for one texture in ex2d?

    I'm looking after a solution where I can use same (one) texture for several purposes, like as shadows by applying a multiply shader and then as a highlight by applying an additive shader.

    Current behaviour: If I make two ex2d sprite objects in the scene and assign same texture on each (ex sprite component in the inspector) and change other to have Particles/Additive and other to have Particles/multiply, the first one changes also from the additive to multiply.

    Using different shaders for one texture allows me to save memory, as I don't need to make a physical copy of the actual texture. It would be even better if you could set the shader for a game object (or assign a specific material for a ex2d sprite), not for the texture, as then, it may allow you to use one texture atlas for multiple purposes. (I assume that currently each texture atlases have dedicated shader, and when you change it for one texture in the atlas, it will eventually change the shader for the rest of the textures inside the atlas).

    I don't have any glue how difficult this is to implement or how much does this cause some additional problems (like lot of different materials, increases amount of draw calls due material changes etc.) or does this functionality even exist (At least I'm not aware how to do this). Making several atlases according the shader assigned to the atlas ends up to situation where I have several copies of one texture in several atlases according the shader...

    One solution may be writing a script which changes the shader at awake, but this easily makes the maintenance of the game more difficult.

    Br,

    - Moopi
     
  17. nia1701

    nia1701

    Joined:
    Jun 8, 2012
    Posts:
    74
    This is a word wrapper posted some pages ago by soulburner....
    In experimenting with this code I found that you need to add the current character back to the current word at line 35 other wise you loose a character after a line wrap...
    cur_word += c;
    Great wrapper, and I hope it helps out others!
     
  18. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi mkandersson,

    Just enable the "Use Contour Bleed" and "Use Padding Bleed" in the atlas editor and rebuild the atlas, the problem will gone. This feature is available in the ex2D v1.2.6.
     
  19. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi Moopi,

    You can create a new material (clone from the original one in atlas), and in the sprite you wish to change its shader, just drag the new material to Mesh Renderer's Material option in Inspector, things solved!

    BTW: using different shader will increase the draw call, so it is not recommended.
     
  20. moopi

    moopi

    Joined:
    Apr 24, 2012
    Posts:
    39
    Thanks Wu!

    This seems to work perfectly.

    Additional draw call is not a critical issue as long as the performance of the game is at acceptable level.
    I'm looking after the balance between performance and memory usage in mobile devices: how to fit game in 50MB (IOS) with acceptable performance.

    Ps. I'm very pleased about ex2d customer care, so very big thanks for you Wu!
     
  21. UniBoy

    UniBoy

    Joined:
    Oct 6, 2012
    Posts:
    1
    Hi Wu Jie,

    Nice work so far.

    But I want to find out if ex2D will support Flash Export on current Unity 3.5 and the upcoming Unity 4?

    I am trying other 2D solutions for Unity right now, and I am looking for one that supports this feature.
     
  22. moopi

    moopi

    Joined:
    Apr 24, 2012
    Posts:
    39
    Hi!

    Is there some nice/easy way to fade in - fade out outlined text (except bitmap font with burn-in borders)? I'm having bad visuals when lerping alpha channel with texts having dark outline colors (dark color "burns" throught the font when it becomes transparent. This happens even I lerp the border color). It seems that the outline is made by copying the actual font sprite and pasting it (several copies) behind the font with some offset.

    I noticed that in your game Money Witches, you are able to fade nicely text with black borders.
    You have also nice scaling effects, how have you made those (with itween or similiar).

    Br,
    - Moopi
     
  23. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi UniBoy,

    We only do a minimum support for flash which is I only check the compile successfully. The performance is not optimized, if you want to get flash build version, send me E-Mail I'll make one for you.

    Regards,
    Wu
     
  24. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi moopi,

    Currently no, the outline effect required two texture atlas one for original font, the 2nd for outline. This feature is under researching in v2.0.

    Regards,
    Wu
     
  25. hamedaf

    hamedaf

    Joined:
    Oct 8, 2012
    Posts:
    2
    hey Wu,

    how can we email you?
     
  26. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi hamedaf,

    You can send me E-Mail through: KarasAya [at] gmail [dot] com
     
  27. vpin

    vpin

    Joined:
    Mar 15, 2012
    Posts:
    19
    Hi Wu Jie,

    There are two problems associated with a large number of sprites in the project (about 2000 sprites on the scene).
    1) If I change the atlas - the very long update of the scene
    2) memory leak on android -
    very similar to that sprites have become invisible - are not removed from memory
    and the very large number of them - lead to problems with memory.

    Is there any way to solve this problems?

    Regards,
    vpin.
     
  28. moopi

    moopi

    Joined:
    Apr 24, 2012
    Posts:
    39
    Hi!

    Is there any easy way to fade in/fade out a GameObject with several childrens attached (exSprites, exSpriteBorder,exSpriteFonts).
    I'm looking after a menu/help window at the top of game which zooms in/out and fades in/out.

    Some solutions I have thought for fade in/out:
    -cutoff shader and lerp for cutoff (limits shader options)
    -go through each child and check if they have some of the ex components attached, then lerp color value of specific ex component (three loops + three GetComponentsInChildren per lerp step, potential performance issue)

    - Moopi
     
  29. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi vpin,

    1) I think right now you have to wait until I finish v2.0. The 2000 sprites could be a problem in my first design,
    2) Put the sprites to the Resources folder and load/unload them dynamically in your scene. No matter how big your project it is, the memory of mobile devices is limite, don't do anything that will obiviously exceed the maximum memory. In our project Money Witches, we have many charater and each character have its animation, skill and other things, when we start a game, we only load resources relate to this character, in this way we can avoid loading for a long time and save memory.
     
  30. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi moopi,

    Just write a fade in/out script, and search all childrent in the Awake/Start function and cache them. And when fade In/Out, foreach of them and do the rest of things. There is no easy way, everything is script and you have to choose from faster preset or faster dynamic set. If you know which children you will controll, public them and connect to the script, if you know the type of the component you are going to controll, use GetComponentsInChildrent<T>(), but you have to tell Unity the exactly things you are going to controll, otherwise you got nothing to fade In/Out.
     
  31. AntFitch

    AntFitch

    Joined:
    Jan 31, 2012
    Posts:
    243
    Hi Wu, I wanted to double-check the date for v2.0. Do you think it will still be out in a month? Is Money Witches using the new version? Your game sounds cool, btw.
     
  32. Time-Jockey

    Time-Jockey

    Joined:
    Oct 11, 2012
    Posts:
    14
    I'm really curious about the date at the moment too, is there an ETA? Also, do you have a feature list for 2.0? I'm really keen on getting a tile editor.

    Also, when generating atlases, I've noticed you generate normals, but do you generate tangents too? If not, is there an option to turn that on?
     
  33. vpin

    vpin

    Joined:
    Mar 15, 2012
    Posts:
    19
    Thanks for the reply.
    We will wait for v2.0
     
  34. bomberest0

    bomberest0

    Joined:
    Oct 7, 2012
    Posts:
    12
    How to set the texture to exSprite from editor script?
    I try this:
    sprite.SetSprite(list[0].atlas, list[0].index, true);
    sprite.ForceUpdateMesh(sprite.meshFilter.sharedMesh);
    Sprite changed for one frame but it doesn't work when i try reselect the object with exSprite, texture link is not changing in the inspector
    P.S. Простите за мой английский :)
     
    Last edited: Oct 11, 2012
  35. Time-Jockey

    Time-Jockey

    Joined:
    Oct 11, 2012
    Posts:
    14
    Any chance I could get a beta copy of 2.0?
     
  36. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi Time Jockey,

    The beta test of ex2D v2.0 will be started after Money Witches release. Right now I can only focus in one project but don't worry about that, I won't that you dispoint in the new version and the new features of the next ex2D.

    The v2.0 plan to release in September but we got so many problem in publish Money Witches and delay for nearly one month. The Money Witches will be released in November 15 if our App Submit goes well. And I will release from the project and focus on the ex2D v2.0 publish. I hope the whole process will be done in two weeks in the plan, but still can't promise the date currently.

    The Money Witches use a customize version of ex2D, the v2.0 developing in a separately project that use Money Witches' resources for testing. I have two things prevent me release the new version:

    1: A project successfully convert from ex2D v1.+ to v2.0.
    2: A project that using v2.0.

    The first thing will be Money Witches, and the 2nd one can be done in beta testing.

    I hope you can understand and be patient to wait for the new version. I am only one programmer that developing all of these and it is exhausted to develop a [super] high quality game.
     
  37. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi Andrew,

    There is a document talking about this: http://www.ex-dev.com/ex2d/wiki/doku.php?id=manual:advance:create_sprite_by_texture

    You need to set the sprite.textureGUID at the end.
     
  38. bomberest0

    bomberest0

    Joined:
    Oct 7, 2012
    Posts:
    12
    Last edited: Oct 12, 2012
  39. harlock1975

    harlock1975

    Joined:
    Feb 27, 2012
    Posts:
    46
    Hi Wu,
    I am still struggling to sync two sprites for my game. My character should be able to change weapons, so I have two separate sprites, one for the character and one for the weapon.
    I managed to sync them by using messages: for each frame I send a SyncWeapon message, received by my character script that looks up the current animation and frame, and then changes the weapon position according to that.
    It works but creating the lookup array is very time consuming. I am trying to create a small editor extension to do that but I am not able to. This is the editor window I created
    $control.png
    I have two questions
    1. is this approach too heavy? I mean, sending a message each frame
    2. how can I play ex2d animations (step by step) in the editor and also have the SyncWeapon message?
    Thanks!
     
    Last edited: Oct 14, 2012
  40. Wild-Factor

    Wild-Factor

    Joined:
    Oct 11, 2010
    Posts:
    607
    What new feature we will get in the 2.0 version ?
     
  41. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi Harlock,

    1. Yes, it is expensive to use SendMessage every frame
    2. You can only play ex2d animation in the preview window (step by step) in ex2D's sprite animation editor. But you can't do that in Scene Window.

    I'm not quite understand about the SyncWeapon message you are talking about. If you about to SendMessage every frame, you probably can do it by attach a script and reference to other component you want to operate, and directly call it by function. This way is much cheap than SendMessage.
     
  42. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi Wild Factor,

    The v2.0 will change the sprite structure to avoid the rebuild of the scene and prefab when user change its atlas.
     
  43. harlock1975

    harlock1975

    Joined:
    Feb 27, 2012
    Posts:
    46
    Hi Wu,
    I did not make myself clear. I am adding an event each animation frame change in the ex2d animation editor.
    I assume that when doing so, ex2d will use SendMessage to broadcast the "event" to whichever script component is attached to the object. Am I wrong?
    So, isn't this expensive?
    Thanks!

     
  44. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi harlock,

    ex2D will SendMessage ( not BroadcastMessage, they are different) to the object you attach sprite animation component. And this is a little bit expensive because SendMessage will search every component and find if there have an interface to call.
     
  45. harlock1975

    harlock1975

    Joined:
    Feb 27, 2012
    Posts:
    46
    Ok, so now my question is: how can I sync two different sprites without using this expensive solution?
    Thanks again!
     
  46. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    There is no cheap way in my understanding of your case. You have to play one animation, and SetFrame to other one while the main animation playing. Or you can make the two animation have the same speed that will make sure the animation playing correctly with each other.

    Would you mind to send me a project with the animation you are working on? I can help you check if there are any better ways to do this.
     
  47. harlock1975

    harlock1975

    Joined:
    Feb 27, 2012
    Posts:
    46
    My solution is pretty simple actually: each animation frame change I send a SyncWeapon message, the Player script gets it, looks up the current animation and frame in a Vector3 array and adjusts the weapon position/rotation accordingly. Creating the array is the most annoying thing of the process.
    If I can, I will try to set up a small project to demonstrate the problem.
    That's why I am curious to know HOW others are handling compound sprites with ex2d.
    Thanks
     
  48. nia1701

    nia1701

    Joined:
    Jun 8, 2012
    Posts:
    74
    Hi Wu Jie, Did this ever get resolved? I have the latest version and when I hit H-Flip my sprite disappears ....I'm using Transparent/Disffuse lighting and a directional light. Thanks!

    ** Never mind
    I am now using this shader to do it....do you think this is a good way??

    Code (csharp):
    1. // Simplified VertexLit Blended Particle shader. Differences from regular VertexLit Blended Particle one:
    2. // - no AlphaTest
    3. // - no ColorMask
    4.  
    5. Shader "Mobile/Particles/VertexLit Blended" {
    6. Properties {
    7.     //_EmisColor ("Emissive Color", Color) = (.2,.2,.2,0)
    8.     _MainTex ("Particle Texture", 2D) = "white" {}
    9. }
    10.  
    11. Category {
    12.     Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
    13.     Blend SrcAlpha OneMinusSrcAlpha
    14.     Cull Off ZWrite Off Fog { Color (0,0,0,0) }
    15.    
    16.     Lighting On
    17.     Material { Emission [_EmisColor] }
    18.     ColorMaterial AmbientAndDiffuse
    19.  
    20.     SubShader {
    21.         Pass {
    22.             SetTexture [_MainTex] {
    23.                 combine texture * primary
    24.             }
    25.         }
    26.     }
    27. }
    28. }
     
    Last edited: Oct 18, 2012
  49. AntFitch

    AntFitch

    Joined:
    Jan 31, 2012
    Posts:
    243
    How do I change the texture offset at runtime, using Ex Sprite?

    Thx!
     
    Last edited: Oct 19, 2012
  50. johnny_karas

    johnny_karas

    Joined:
    Sep 20, 2010
    Posts:
    704
    Hi trothmaster,

    The problem Moopi said is about the normals direction in the sprite, and it has been fixed in the last version. What you meet is a problem in shader, you should turn off the Cull just like what you write above.