Search Unity

Smooth Moves - 2D Skeletal Animation

Discussion in 'Assets and Asset Store' started by echo17, Feb 20, 2012.

  1. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    I have thought about it, but there are a couple reasons why I haven't decided to release at this point:

    1) My other plugins that I have released the source to have been duplicated and sold at lower prices on the asset store.
    2) Supporting open code that may or may not include user changes (and user bugs) becomes increasingly difficult.

    If I do decide to release the source, then I would definitely have to scale back my support.
     
  2. kenwong

    kenwong

    Joined:
    Jan 22, 2012
    Posts:
    24
    hi echo,

    just recommended smooth moves to some friends. the showcase in your initial post links to your forum, which isn't visible unless you register. if that was intentional it's a real shame, as i'm sure a lot of people can't be bothered registering just to check out screenshots/videos of your plugin in action.
     
  3. Saikobooru

    Saikobooru

    Joined:
    Oct 30, 2012
    Posts:
    31
    Hey,

    Seems like I've run into a bit of a problem. When I've set up the texture atlas(with pivot points) and bone animations, after re-opening the project and having look at the animation again, all the pivot points have been reset, and putting them back to their original position still doesn't make it look right in the animation.
    Got any ideas of why this is happening?
     
  4. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Ooops! I'm pretty new to forum management, so I had some incorrect settings in place. Fixed it now, so you should be able to view all boards with guest access. Thanks for pointing this out!
     
  5. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Be sure you are on the latest version of SmoothMoves. I have a patch in a recent version that fixed the pivots going missing.
     
  6. BytesOfChicken

    BytesOfChicken

    Joined:
    Jan 12, 2013
    Posts:
    34
    Hi Echo

    New to smooth moves, have tried to read some of other post but too many to trall through. Anyways I have an animator who does all the animations using smooth moves on another pc but he doesnt know much about coding, 3D world and basically putting a game together, which is where i come in. Whats the best way for him to get me the files i need and for it to work straight out the box similar to your demo dough game. Also I need a way that wont overwrite all the work Ill do like addings scripts, adding collision to the animations etc?
     
  7. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    For sharing your files, have a look at chapter 9 of the User Manual.

    I wouldn't add scripts directly to the BoneAnimation object. Instead, I would make the animation object a child of another game object. You can then attach all your scripts to that parent game object, making reference to your animations if necessary. This way whenever you bring in your animator's work, it won't overwrite the scripts you have attached. Have a look at the "Rise of the Dough" project included with SmoothMoves. You'll see this structure on the Chef game object (with his animation as a child object).
     
  8. BytesOfChicken

    BytesOfChicken

    Joined:
    Jan 12, 2013
    Posts:
    34


    https://www.dropbox.com/s/y7ab3dicvs571om/Screen%20Shot%202013-01-19%20at%2017.14.17.png
    https://www.dropbox.com/s/h76lthqq00ywr6t/Screen%20Shot%202013-01-19%20at%2017.13.39.png

    Hi Echo

    Im having an issue with the animations, I have closely followed the tutorial but something is going wrong somewhere. The animations look crisp in the animation editor but when applied to a bone animations in the unity3d scene the pivots seem to be all over the place. if this has been discussed previously please point me in the right direction. I can send you the project if need be as we have not done much as we got this issue at the first hurdle.

    (Update)
    Hi Echoe

    After looking (1 day and a half) for a reason why my animations seemed to loose their pivots when in the unity editor, I started to think maybe the size of my image files were to big and causing some strange problem with the animation (my texture images were 512 some images had loads of transparent space around). I ended up trimming all my images in photoshop and this seemed to have fixed the issue after i redid the pivots again. Do you think you can look into this as If it is a problem with image size or trimming images that could mess up others.

    Thank you in advance.
     
    Last edited: Jan 20, 2013
  9. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    Hi, i have two questions:

    is it possible to switch parents, like i have an helmet childed to the head but during the animation i want to change the parent to be the hand, is it possible?

    and about Mix animation, if i create an attack animation and use mix animation option to the shoulder/arm/hand only, then if i have different animation currently playing (walk or idle) the will display same but only the shoulder/arm/hand of mixed attack animation will display over right ?




    and obviously there is a bug with playmaker, when i build the animation in the scene, if the prefab is not the same as gameobject in scene it will duplicate childed gameobject of my animation who have a fsm.
     
  10. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    This is actually a feature (or bug depending on your perspective) of how Unity packs textures into an atlas. If the individual textures won't fit within the allotted size, Unity will trim the individual textures to fit (not the final result). This causes the final animation to experience the weird offsets that you are seeing. Since the editor uses the original textures and not the final atlas, it looks normal there.

    You can get around it by increasing your texture size in the atlas editor. If you need your final atlas smaller, then you can override the texture size in Unity's inspector on the atlas texture itself.
     
  11. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    No, sorry this is not possible.

    As long as your have the mixed attack animation on a higher layer, it will play on top of whatever animation is playing below it.
     
  12. kenwong

    kenwong

    Joined:
    Jan 22, 2012
    Posts:
    24
    Here's the trailer for Hackycat! The start bit and the title cards are done in AfterEffects, but the in-game animation is all smooth moves! Will be coming out in a few weeks, for iPhone, iPad and iPod touch.

     
  13. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Super Cool! I will definitely buy this when it comes out. Would you mind putting a thread for this in the Showcase (http://www.echo17.com/forum/index.php?board=7.0)? I love seeing what people can do with the plugin! great work.
     
  14. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,315
    do you mean i need to put my mixed attack arm in smoothmoves in layer 1,2,3 for exemple when my other animation bones on other animation are at 4,5,...30?

    if my arm in other animation is layer 1,2,3 too, it will not work?
     
  15. nousica

    nousica

    Joined:
    Jan 23, 2013
    Posts:
    2
    some problem in using play api. i spawned smoothmove boneanimation gameobject and in the same frame i called play api , but animation was not changed.
    but after one frame later calling playapi made it to work correct. is this working properly..?
    spawn gameobject
    boneanimation.play("sit") <- not working

    but

    spawn gameobject
    one frame.later
    bone.animation.play("sit") <- working.
     
    Last edited: Jan 23, 2013
  16. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    The layers are by animation clip, not bone. Have a look at this tutorial:

     
  17. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    The SmoothMoves BoneAnimation class has to set up some internal data structures (mostly dictionaries for faster runtime lookup -- which can't be serialized) when they are instantiated. Because of this, the animation will not be ready for playing the first frame it is created.

    You can do one of two things:

    1) Instantiate your animations at design time and disable them until you are ready to use them
    2) Call the play functions one frame after instantiation

    My recommendation would be to use the first method. I would recommend this for many reasons, mostly because you won't have new allocations occurring at runtime which can cause hiccups in the CPU (depending on your platform). This is a much more efficient method because you then have a pool of resources ready to be used at any time. When you are finished with an animation, you can then just disable (not delete) the resource.
     
  18. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    I've added links in my first post of this thread to the two completed projects that I know of using SmoothMoves: "Poppy Cat" and "Hackycat".

    If anyone else has finished a game or app using SmoothMoves, please share! I'll add it to my gallery.

    Also, if you just want to share a work in progress, check out my forum board for this here
     
    Last edited: Jan 23, 2013
  19. sanjodev

    sanjodev

    Joined:
    May 29, 2012
    Posts:
    63
    Hi echo17,

    I have a touch control performance issue that I've noticed on ipod touch 4th generation. I don't think it has anything to do with Smooth Moves but you confirm, and then I'll move my question to the broader Unity3d forums.

    The issue I am having is that when I touch the screen when my game is running, and drag my finger around the screen, I notice I go from 29-30 fps to about 23 fps. I've dug through all my code to find instances where I do any input stuff, and disabled them to see if performance still drops, and the issue still happens. I've gone as far as run my game until the main game runs, then disable all game logic updates to the game at run time, so my game code isnt really running much anymore. I can easily do this because I dont use any of the magic Unity "Update()"/"FixedUpdate()" in any of my game objects, except for the main application host, which is where I explicitly call all my Update functions even for checking input.

    Currently have have about 11 Smooth Moves objects on screen characters, each with 12 bones or so. I noticed if i removed like half the objects, so my game loads less characters, and then do my touch the screen test, and move my finger around, the performances drop is less than the intial test, but still noticeable (3-4 fps drop). So in my head, I'm thinking touch performance seems to be more problematic if i have more characters on screen.

    So my question to you is, does Smooth Moves have code where it does the Physics.RayCast thing anywhere? Or do you suspect its Unity3d, doing its own input code when you touch the screen to gather info for its Input classes. Or do you suppose its Apples OS code or hardware issue? Again this is just for Ipod touch 4th generation where I notice this issue.

    I also tried seeing if Unity3d had some variables that control which objects are taken into account for Input.RayCast, such as maybe something like gameObject.rayCastDisable = true, but I didnt find anything like that so far. I know its not my calls to RayCast, but you never know what other code I have no control over could be calling the RayCast function.
     
    Last edited: Jan 25, 2013
  20. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Hey there. Well, this could be a gazillion different issues, maybe even lots of little things acting together, so it would be difficult to pinpoint based on your description.

    I can tell you that SmoothMoves does no raycasting. In fact, the only physics interactions are when you have colliders on, but that is entirely Unity at that point. SmoothMoves only turns on and off the colliders.

    One thing you might check is what happens in the animations when you do your finger interactions. If you are calling animations that have a ton of keyframes, there might be a lot of mesh rebuilding when it swaps textures or pivots.
     
  21. geo123

    geo123

    Joined:
    Nov 20, 2012
    Posts:
    10
    Hi echo17 ,
    I am a newbie unity developer. The smooth plug is great and same much of time for game development.
    A question want to ask is can I add ngui button together with smoothmove animation object in same scene? It seems had different camera views.
    I cannot see my newly added button from game play scene.
     
  22. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    I generally keep my game objects and GUI objects on two different cameras, even if both use the same projection. This way you can always have your GUI objects rendered last (on top of other objects). Try creating a new camera and have your animation objects on a layer that this new camera can see.

    Keep in mind that SmoothMoves animations are just 3D objects like any mesh, they just happen to be flat. Using this, you should be able to find some posts in this forum or the unity answers site that talk about combining 3D and GUI objects / cameras.
     
  23. sanjodev

    sanjodev

    Joined:
    May 29, 2012
    Posts:
    63
    Hi echo17, got another issue. The SwapMaterial() function of the BoneAnimation object sounds like a simple enough function. But I noticed looking at the code via ILSpy, that it makes a call to this.GenerateMesh(). The reason I'm looking at it is because my game is getting memory warning issues on ipod touch 4th generation.

    The scenario is that I have pooled game objects and the BoneAnimation objects associated with the game objects are also pooled. My game objects can be colored differently in game, so after I allocate a game object from my pool, I have to make sure its using the right material. My materials come from a prefab, so I dont allocate any new ones at runtime. I just determine which material I need based on color of my game object, and then call the SwapMaterial(). Every 15 seconds or so, I'm allocating a new game objects, so the pooled memory is frequently used, hence the SwapMaterial() is called frequently. Performance is fine, but the memory warnings do occur, and that causes terrible performance spikes at random times, then IOS kills my game probably because of the memory issues.

    I noticed if I comment out the call to SwapMaterial(), and leave the game running for much longer, I dont notice any IOS debug spew warnings about memory issues. Based on the calls to GenerateMesh, I know its creating List objects and all that, which is bad, because in my game code, I explicitly try to avoid creating new containers, so my fix would be to not call Swap Material anymore, or maybe just call it once somehow.

    Thoughts?
     
  24. neken

    neken

    Joined:
    Sep 23, 2011
    Posts:
    35
    Welcome. Thank you for a great product! I have a little problem with setting the Alpha and blend. In the editor, the animation alpha and blend respond very well, but during the game itself, these settings are ignored. You can not see the transition between alpha. Are you aware of this problem may be?

    Thank you for your reply.
     
  25. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    The generate mesh function is actually called each time you swap textures or pivots as well since it has to reset the vertices in the mesh. I'll take a look sometime soon and see if I can find what might be eating up the memory in this function.
     
  26. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Hi there. Be sure you have the "Update Colors" set to true on the bone animation game object. SmoothMoves sets this to false by default to optimize performance if you don't need color processing.

    Check out the 3rd FAQ in chapter 10 of the User Manual
     
  27. Fourthings

    Fourthings

    Joined:
    Feb 15, 2010
    Posts:
    313
    Howdy Echo17, so I bought SmoothMoves when it first came out and have now only gotten the time to start using it, so far I'm very impressed.

    Anyway, I have an issue with pixelation with my art as seen below, how do I resolve this issue and get a clean polished look to my artwork like in the Hackycat trailer?

     
    Last edited: Jan 28, 2013
  28. sanjodev

    sanjodev

    Joined:
    May 29, 2012
    Posts:
    63
    I figured out what it was. I was using material instancing, and I didnt fully understand how it worked. The reason for the memory leak was that, every frame new material instances kept being creating without a single one being destroyed. It has to do in part with how Smooth Moves worked as well. For every frame of animation, Smooth Moves makes sure the right materials are set based on its dictionary. Originally, when I call the SwapMaterials function, I set a non-instance material that is shared for my objects. And so when I later set the shader property, Unity would magically instance the material, but then on the next frame, Smooth Moves would detect that the material doesnt match what it has, and so it would reset the material to what was Swapped. So although the game visually looked right still based on order of setting and rendering, there was a constant material instancing going on.

    My fix was to in the call to Swap Material, I would give it a instanced material to begin with instead of a shared material. That way Unity doesnt try to instance it when I set the property, and Smooth Moves doesnt try set the material because it think its different.
     
  29. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Thanks!

    The pixelation could be a number of things:

    1) For pixel-perfect rendering (one art pixel = one pixel on the screen), you should use an orthographic camera with the ortho size set to half the screen height.
    2) Check the filter mode of your atlas textures. Point is good for GUI elements, but sometimes bilinear or trilinear makes the textures seem smoother.
    3) Be sure your atlas textures do not have "Generate Mip Maps" set to true. Mip maps are great for 3D surface textures that vary in distance from the camera, but are horrible for 2D textures in a fixed orthographic camera.
    4) Be sure the format of your atlas textures are not compressed. Compression is great for saving space, but it can leave artifacts (blurry spots) in your textures.
     
  30. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Good to know. Thank you for posting your solution here!
     
  31. Fourthings

    Fourthings

    Joined:
    Feb 15, 2010
    Posts:
    313
    Oh right, so before breaking the character down into it's respective parts in photoshop, I should ensure the resolution of the source image is the same as my intended resolution on screen? Or would I get better results from it being slightly larger, like maybe twice the resolution?
     
  32. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    I would definitely make your images at least twice as large. You can always scale down, but it's pretty hard to scale up without getting some fuzziness. Also, having larger images lets you be ready for when Apple comes out with the SUPER retina display :)

    Just be sure that you allot enough room for your images in the atlas editor by setting the max atlas size large enough. You can then scale down the final atlas texture that is generated by setting the "Max Size" setting in the inspector.
     
  33. Fourthings

    Fourthings

    Joined:
    Feb 15, 2010
    Posts:
    313
    Awesome, thank you for the advice I appreciate it!
     
  34. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    You're most welcome
     
  35. geo123

    geo123

    Joined:
    Nov 20, 2012
    Posts:
    10
    Hi echo17,
    Many thanks for your help to let know use another camera to render GUI elements. Just like your example. I had success do it with NGUI .
    I had another question. I had another plug-in called 'cartoon fx' particle effects which need to be use together with smoothmove bon amination. However I found there scaleling problem which the size of cartoon fix. The particle I put to game same scene seems get very small compared with my smoothmove bone animation. I even can only show a dot like object on game scene. I know it is the camera setting incorrect. But don't know how to get solved with it. I set the carmera view to orthoganic.
     
  36. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Good news!

    I don't have the cartoon fx package, so I won't be able to comment on how to adjust it. For SmoothMoves, you can scale your animations down to match your environment pretty easily. Just set the mesh import scale on the BoneAnimationData asset to a number below 1.0f. For instance, 0.5f will scale your bone animation down to half of its normal size. Since the particle effects are very small, you might want to try a tiny number, like 0.01f or something.

    Check out the tutorial video (1:30 to 2:00 range):
     
  37. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
  38. kreddy

    kreddy

    Joined:
    Oct 5, 2012
    Posts:
    9
    Hey Echo17,

    Could you please share how you implemented the "Create Separate Mesh" feature in Smooth Moves.
    It was a great feature in Smooth Moves, but I need to recreate the functionality for non smooth moves sprites.

    thank you!
    kedar
     
  39. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    I call the following code from an editor script (_sprite is a reference to my sprite component):

    Code (csharp):
    1.  
    2.  
    3.     PrefabUtility.DisconnectPrefabInstance(_sprite.gameObject);
    4.     _sprite.DisconnectInstance();
    5.     EditorUtility.SetDirty(_sprite.gameObject);
    6.  
    7.  
    Breaking it down:

    First, I call the prefab disconnect on my sprite's gameobject. This makes sure the mesh data is not being shared among objects created by the same prefab:

    Code (csharp):
    1.  
    2.  
    3. PrefabUtility.DisconnectPrefabInstance(_sprite.gameObject);
    4.  
    5.  
    Then, I have a function in my sprite class creates a new mesh for the sharedmesh object of the mesh filter. After creating the new mesh, I fill it with the mesh data (arrays like vertices, colors, normals, etc):

    Code (csharp):
    1.  
    2.  
    3.         public void DisconnectInstance()
    4.         {
    5.             _meshGameObject = gameObject;
    6.  
    7.             if (_meshGameObject != null)
    8.             {
    9.                 _meshFilter = _meshGameObject.GetComponent<MeshFilter>();
    10.                 if (_meshFilter == null)
    11.                 {
    12.                     _meshFilter = _meshGameObject.AddComponent<MeshFilter>();
    13.                     _meshFilter.sharedMesh = new Mesh();
    14.                 }
    15.  
    16.                 _meshFilter.sharedMesh = new Mesh();
    17.                 _mesh = _meshFilter.sharedMesh;
    18.  
    19.                 _mesh.vertices = _vertices;
    20.                 _mesh.uv = _uvs;
    21.                 _mesh.colors = _colors;
    22.                 _mesh.triangles = _triangles;
    23.                 _mesh.normals = _normals;
    24.                 _mesh.RecalculateBounds();
    25.                 _mesh.RecalculateNormals();
    26.             }
    27.         }
    28.  
    29.  
    Finally, I set the sprite gameobject as dirty so Unity will update it:

    Code (csharp):
    1.  
    2.  
    3. EditorUtility.SetDirty(_sprite.gameObject);
    4.  
    5.  
     
    Last edited: Jan 31, 2013
  40. BytesOfChicken

    BytesOfChicken

    Joined:
    Jan 12, 2013
    Posts:
    34
    This is some of our more basic animations from a game we are working on, Smoothmoves is being used for the animations and its making our work so much easier and we just love it :)

    Heisenberg smoothmoves animations
     
  41. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Very cool, thanks for sharing! Can't wait to see the final game.

    If you want, you can also post this in my showcase board on my forum at:

    http://www.echo17.com/forum/index.php?board=7.0
     
  42. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    I finally managed to update from old version to 2.0 and everything worked but if I close and then reopen the project unity crash.
     
  43. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Unity sometimes has issues when importing updates to plugins. For this reason, I suggest creating a completely new project and importing the plugin there. You can copy the plugin dll's from the new project to your working project using your OS's file system. Also, always back up your work before importing from the asset store.

    Have a look at the upgrade guide here:
    http://www.echo17.com/support/smoothmoves_v2_upgrade_guide.pdf
     
  44. danboutros

    danboutros

    Joined:
    Mar 26, 2012
    Posts:
    32
    Hi Echo.

    I have an issue to ask about, and a workaround to share in the interim

    THE ISSUE - WHEN I ADD A NEW TEXTURE TO AN ATLAS, AND REBUILD THAT ATLAS, ALL MY ANIMS RELIANT ON THAT ATLAS, DIE!
    I've recently been needing to add some textures to a very large atlas that is central to the game.

    I did so and then reeled back in horror as my prior animations were all dead.

    THE WORKAROUND...
    I looked at the Atlas and it moved some of the textures around in its layout. It seems that it lays out texture automatically IN ALPHABETICAL ORDER, so I renamed my new textures so that they would appear AFTER the existing textures and therefore not disturb the layout.

    Thing is, there must be a way to create atlases, add new textures to them and not destroy present work. Is it possible with Smooth Moves?

    Is there a way to reference the settings and layout of the texture, rather than the layout and global settings of the texture within the atlas?


    OTHERWISE, HERE IS A WISHLIST OF FEATURES I'D LIKE TO SEE IN SMOOTH MOVES, BECAUSE I LOVE IT SO:
    1. Copy-paste collider settings located in a frame of animation, across a whole animation.
    2. Copy-paste of entire columns of anims, instead of just rows.
    3. Copy-paste individual settings located in a frame of animation, animation-wide.
    4. Inverse Kinematics (but of course!)
     
  45. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    If you rebuild your atlases, just do a rebuild of your animations as well. This will update them with the new atlas information.

    You can copy collider settings currently. Go into the settings section of the animation editor. You'll see a drop down with a list of properties that are copied. Just be sure collider is selected.

    You can do this as well. Just double click on the frame and it will select all the frames in that column. You can then move, copy, and paste just like with individual frames. Also, you can individually select multiple frames as well and copy that way too.

    See the answer to #1

    On my list, but I haven't looked into the feasibility / impact of this.
     
  46. danboutros

    danboutros

    Joined:
    Mar 26, 2012
    Posts:
    32
    Thanks Layne!

    Other wishlist item:

    - Force Rebuild for individual anim files, for those that won't get processed yet into a scene, just to keep progress up.
     
  47. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    You can sort of do this now by creating a new bone animation, attach the data, then click the force build button on just that bone animation (new feature added very recently).

    I will add it to my list to force build just the animation data, though.
     
  48. dasbin

    dasbin

    Joined:
    Jan 14, 2012
    Posts:
    261
    Hi echo,

    How does one reliably hide a bone in a particular animation clip, without resorting to scripting, and without affecting the other clips in the animation, when mixing animations?

    The "Deactivate bone" (little red x) doesn't work, because it seems to deactivate the bone for every clip in the animation if is it active in a blended clip but inactive in a non-blended clip.
    Setting the bone in a clip to "transform only" (no sprite image) works most of the time, but occasionally will randomly show the sprite anyway in-game in an inappropriate clip (presumably from when it was loaded in the blended clip as a sprite).

    Also, I have a really big request: Is it possible for the animation editor to treat depth layers the same way they would be rendered in-game? This is hugely frustrating for me. Often, an animation will appear totally fine in the animation editor, but in-game certain sprites will randomly pop in front of or behind others (because they happen to be on the same layer). I understand there might no way to force Unity to behave any differently, but can you at least break the editor in the same way that Unity is broken, so we can see the bones popping in front while previewing in the animation editor? Right now, when played back in the your editor, the bones maintain a totally consistent layering even when they are overlapping on the same layer (which Unity doesn't do). It would save days of frustrating work if we were able to know there is a problem immediately, and fix the depth problems in your editor without constantly switching back and forth to the game to see if they are all fixed.
    I understand this problem is fixed with more foresight when building the animations, but it can just be overwhelming to keep track of when you have 30+ bones in an animation using multiple materials (and thus trying to keep the number of separate layers to a minimum in order to reduce draw calls), and then add animations later with overlapping movements you didn't foresee ever doing earlier. I just need quick some way of seeing when bones of the same layer overlap within the animation editor so I can fix it right away.


    One last question: For some reason, when mixing animations, bones which are not included in the blended animation clip (ie they are unchecked) still seem to re-set their depth value to whatever is in that blended animation, when the clip is played in game. So I have to go through and purposefully set all those depths on every bone even though they are not included in the clip. Is this intended behavior?
     
    Last edited: Feb 7, 2013
  49. echo17

    echo17

    Joined:
    Nov 24, 2011
    Posts:
    1,252
    Setting to transform only should allow you to hide the bone for just the single animation clip. The reason you are seeing the bone pop in is because it is probably set to an image type in another clip that is being blended.

    When thinking about bones, you have to envision them as separate from the animation clips. They persist no matter what animations are being played on them. They function much as a state machine does. Each time an event like an image change or a depth change is fired, you are setting the state of the bones. When two blended animations are being played, both are setting the state of the bones. In this case, one of your animations is trying to set the bone as a transform and another is trying to set the bone as an image. This causes your bone to alternate between an image and invisible.

    The editor uses GUI textures to render the animation. Unity uses a skinned mesh. In the editor I display the bones in order from highest depth to lowest depth. If two images are at the same depth, there is no guarantee that one will be displayed above another.

    In the Unity mesh, I create a triangle list that tells Unity what order to render the quads of each bone. Again, if the depth is identical, there is no guarantee that one bone will be rendered before another since this is arbitrarily decided.

    The reason the editor and the mesh don't always agree to the arbitrary ordering is because one is being rendered as a mesh with a triangle list and one is being drawn with a set of GUI textures.

    It is like sorting any list of objects. If two objects have the same value, there is no way to force one to be in front of another. In these cases it is best to explicitly set each depth to get consistent ordering.

    Yes, this is the intended behavior. Depth is a trigger that is fired to change the state of a bone. Once that state is set, it won't change until another trigger comes along and changes the state again. Your method of explicitly setting the depth of your bones in all your clips will guarantee that the correct depth state is set for the animation that is playing.
     
  50. dasbin

    dasbin

    Joined:
    Jan 14, 2012
    Posts:
    261
    Hmm, this is the interesting part. The image is popping in well after the blended clip (which included the sprite) had stopped by being interrupted by the non-blended clip (which sets the sprite to transform only). It's definitely not trying to play the blended clip there, and the only symptom of a problem is the sprite very occasionally popping into view (if it was trying to play a blended clip erronously, I would expect some other sign of movement, or for that transform-only bone to be in the spot it should be at in the blended clip).

    I understand.
    I wonder then if I can rephrase my request: is it possible show *something* in the editor in areas where two bones of the same depth are overlapping? Like flash a color or something?