Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Spine: 2D skeletal animation

Discussion in 'Assets and Asset Store' started by NateS, Feb 10, 2013.

  1. Pix10

    Pix10

    Joined:
    Jul 21, 2012
    Posts:
    850
    When you import your character into Unity, the SkeletonData object (in the character's import directory) which references the Sprite Collection and Skeleton JSON in it's Inspector has an array, Animation State Data. It is here that you define AB, BA, AC, CA, CB, BC etc blend timers.

    If you have an "idle" and a "walk" animation, and set the blend value to 0.5 for idle to walk, then:

    skeletonAnimation.state.SetAnimation(0, "walk", true);

    Will blend between the two over 0.5 seconds.

    http://esotericsoftware.com/spine-using-runtimes/
     
  2. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Is there a way to Add a Mix at runtime? So far I only see SetMix, but does that Add a Mix, or just Set a pre-existing Mix at runtime?
     
  3. MarioRuiz

    MarioRuiz

    Joined:
    Nov 7, 2009
    Posts:
    161
    Hey guys, I'm trying to import a spine object that has free form deformation but it doesn't seem to be working, I mean, if the spine object doesn't have ffd it works right away, any ideas? this is the error I get when trying to create the skeleton mesh
    Error reading skeleton JSON file for skeleton data asset: New SkeletonData
    The requested value 'mesh' was not found.

    edit: Well the thing is just mesh isn't supported yet, so ffd on unity runtimes will have to wait...

    Moving onto new issues, I need to turn slots on/off at runtime, anyone has done it before or has any advice on this? the closest thing is fading the alpha to 0 but that wastes fillrate...
     
    Last edited: Feb 25, 2014
  4. zenGarden

    zenGarden

    Joined:
    Mar 30, 2013
    Posts:
    4,538
    How is workflow with Spine and Unity ?
    I mean exporting to Unity without using some external tool like posted in the forum , it is easy ?
     
  5. DevMac1

    DevMac1

    Joined:
    Aug 1, 2013
    Posts:
    2
    Hi everybody! I have some strange problem! This problem is not regular, but I get it very often! When I import spine animation in Unity I have an error "Error reading atlas file for atlas asset: bonusAtlas
    The requested value was not found."
    And I don't know how to fix this! Everything is ok in SPine, but in Unity I have this error! How to fix this?
     
  6. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    I have the same problem recently! I think this is a bug!
     
  7. ChiliJuan

    ChiliJuan

    Joined:
    Apr 11, 2014
    Posts:
    3
    Same here
     
  8. KepleriansTeam

    KepleriansTeam

    Joined:
    Mar 14, 2014
    Posts:
    31
    Maybe it's late..

    I have just bought Spine Proffesional and i had the same problem.

    I solved it renaming the JSON Files(which creates Spine exporter), adding ".txt".
     
  9. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Regarding the "Error reading atlas file for atlas asset: The requested value was not found."

    Here's the solution we found to fix our problem.

    http://docs.unity3d.com/Manual/ImportingAssets.html

    Never move any assets or organize this folder from the Explorer (Windows) or Finder (OS X). Always use the Project View.

    We found that we were dragging the JSON file we exported from Spine into our Unity folder through Windows Explorer every time we updated the Spine atlas, rather than dragging the JSON file into Unity directly. Also, we renamed the JSON to be a .txt to correctly import into Unity.

    If the file still had those errors, then we would close Unity, restart Unity, and then try dragging the JSON back into the Project view of Unity.
     
  10. hxx2010

    hxx2010

    Joined:
    Aug 31, 2009
    Posts:
    155
    AnimationState.AddMixingTransform
    spine Lack of important functions
     
  11. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    I cannot build for Windows Store. Any suggestion?

    Assets\spine-csharp\src\Atlas.cs(71,42): error CS1502: The best overloaded method match for 'System.IO.StreamReader.StreamReader(System.IO.Stream)' has some invalid arguments

    Assets\spine-csharp\src\Atlas.cs(71,59): error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'

    Assets\spine-csharp\src\SkeletonJson.cs(76,33): error CS1502: The best overloaded method match for 'System.IO.StreamReader.StreamReader(System.IO.Stream)' has some invalid arguments

    Assets\spine-csharp\src\SkeletonJson.cs(76,50): error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'

    ---

    There is some problem with the #if #else!

    Even if it enters on #if WINDOWS_STOREAPP it also enters on the #else of the #if WINDOWS_PHONE, because of this it does not works. This is very strange.

    ---

    Any advice? It should be something simple to fix but I could not make it work.
     
  12. xEclypze

    xEclypze

    Joined:
    Jan 20, 2015
    Posts:
    3
    Quick question, I'm not sure if i read this right or not but do FFD Meshes not work at all in unity? I just bought the essentials verision and I was really looking forward to utilizing the mesh deformation in my animations...
     
  13. MarioRuiz

    MarioRuiz

    Joined:
    Nov 7, 2009
    Posts:
    161
    Yes they do work, if you download the latest runtimes should have no problem.

    They weren't at the time I think...
     
  14. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    I still was not able to build for Windows Store. Anybody was able to achieve it?
     
  15. Tomer-Barkan

    Tomer-Barkan

    Joined:
    Jul 31, 2012
    Posts:
    150
    Any plans on supporting sprites in unity instead of mesh renderer?
     
    martibergoglio likes this.
  16. tloechelt

    tloechelt

    Joined:
    Dec 13, 2013
    Posts:
    5
    Love Spine so far but profiling today brought up an issue with Spine consuming a lot of draw calls.
    We have two atlases and a Material per atlas but in the renderer i see 40 Material used, actually always
    the same two. I get 45 Draw Calls! What i am doing wrong guys?
     

    Attached Files:

  17. Pharan

    Pharan

    Joined:
    Oct 28, 2013
    Posts:
    102
    Hey everyone. I had no idea this thread was here.
    I keep an eye on the Spine-Unity forums over at Esoteric and contribute to the Spine-Unity documentation.

    I guess these posts are kinda too old to answer. The recommendation is still to go ahead and post your questions there. But still feel free to post your quick questions here, I guess, and I'll try to give some concise answers. These Unity Forum superthreads get pretty unwieldy.

    @Wagenheimer There were some fixes to building for UWP since April 2015. Should be working.

    @Tomer Barkan. Sprites would be nice if they had the functionality and flexibility to go with them. We want Spine-Unity to support all the features that Spine is capable of and only MeshRenderer lets it do that right now. SpriteRenderers are just an abstracted and specialized form of MeshRenderer anyway. What about SpriteRenderers makes you prefer them?

    @tloechelt. This happens when you have a lot of images in your skeleton and your atlas is randomly split across two pages. The solution is to keep all your atlas parts in one page/texture, or arrange them so the attachments don't jump between multiple textures so much. You can read more about it here: http://esotericsoftware.com/spine-unity-documentation#So-many-Materials
     
  18. Tomer-Barkan

    Tomer-Barkan

    Joined:
    Jul 31, 2012
    Posts:
    150
    @Pharan wow, this is an old question :)
    I can't quite recall what I was researching at the time, but a few advantages of sprites in unity come to mind:
    1. Simple to use, scale, and well fitted for 2D games
    2. Dynamic batching and automatic atlasing
     
  19. Pharan

    Pharan

    Joined:
    Oct 28, 2013
    Posts:
    102
    @Tomer Barkan
    Scaling works. (not sure if that's what you meant) Spine's components generate flat meshes and it works with the Rect tool. Unity's Renderer sorting properties are exposed. I'm not sure what other characteristics make it more "fitted for 2D games".

    MeshRenderers are actually subject to dynamic batching just like SpriteRenderers are. It's not a problem at all.

    Unity's Sprite Packer is definitely something we're planning to hook onto as a replacement for manual atlasing done through Spine editor, once we hammer out some features we're working on.

    The ability to hook into other atlasing systems is actually proven, since Spine-Unity optionally works with 2DToolkit's atlas system. The matter at hand is whether or not Unity's Sprite Packer Editor API is nice. We did some work on it back in Unity 4.6 and it was a pain so we decided to wait til it matured a bit.

    But the Sprite Packer is pretty independent from SpriteRenderers. Even if we chose to pack Sprites with Unity, we could continue to use MeshRenderers to still be fully featured (mesh deformation, weighted meshes, and some future stuff we're working on.)

    Cheers!