Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Sprite Resolver: Animation Doesn't Work In Runtime

Discussion in 'Animation Previews' started by Dracalis, Apr 1, 2020.

  1. Dracalis

    Dracalis

    Joined:
    Oct 11, 2014
    Posts:
    6
    I'm trying to use the Sprite Library and Sprite Resolver to swap character sprites in an animation. My intention is to create one set of animations that I can use amongst all characters in my game, just by swapping the sprite sheet. It isn't working as intended though.

    The documentation says I should change the Label in the Animation, though the closest property I have to that is "Label Hash". I made keyframes of that, then set the dopesheet's key frame tangents to Constant.

    In the editor, the animation preview seems to work fine:
    Sprite Swap Preview.gif

    But in runtime, it looks like this:
    Sprite Swap Runtime.gif

    And when I try to inspect the curves in my animation, I get this error:

    Mesh 'ControlPointRendererMesh': abnormal mesh bounds - most likely it has some invalid vertices (+/-inifinity or NANs) due to errors exporting.
    Mesh bounds min=(36.00, -nan(ind), 0.00), max=(1064.00, -nan(ind), 0.00).
    Please make sure the mesh is exported without any errors.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    Has anyone had success doing frame-by-frame sprite swaps in 2D animations using the Sprite Resolver? I'm not sure what I'm doing wrong here.
     
    Last edited: Apr 1, 2020
  2. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    435
    Can you share the project with us? You can drop me a PM on a link I can download the repro. Thanks
     
  3. ink13

    ink13

    Joined:
    Nov 14, 2013
    Posts:
    37
    Hey I'm having the same issue - is this something i can easily fix myself?
     
  4. ink13

    ink13

    Joined:
    Nov 14, 2013
    Posts:
    37

    Did you ever figure this out?
     
  5. ink13

    ink13

    Joined:
    Nov 14, 2013
    Posts:
    37
    Ah, if anyone ever gets lost here... It was my mistake. The curves weren't setup correctly on my side.
     
  6. lepistok88

    lepistok88

    Joined:
    Jun 6, 2021
    Posts:
    1
    There’s something strange is happening in the Sprite Library with naming of categories and labels. It’s causes an error when I turn on the Curve Editor. I still don’t understand what the collision of names depends on but I was able to fix the error after I named the labels with serial numbers 1, 2, 3. Also I named the categories in accordance with the name of the layer of the original Photoshop file in which the P.S sprite replacement is occuring. There’s similar problem with 2d animation samples on the alternating sprites Assets / Samples / 2D Animation / 6.0.7 / Samples / 5 SpriteSwap / 6 Skeleton Sharing.unity.
     
    Last edited: Oct 20, 2021