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

Official 2D Animation v2 - Preview Packages

Discussion in '2D Experimental Preview' started by rustum, Dec 17, 2018.

Thread Status:
Not open for further replies.
  1. ArseneySorokin

    ArseneySorokin

    Joined:
    Jan 23, 2013
    Posts:
    63
    Is there a way for me to change the different sprites from the code during Runtime?
    Assuming I wish to import the images from outside the Game, how can I set the new images onto the animation and still maintain the Bind Poses?
     
    Betzalel and EvOne like this.
  2. Kiupe

    Kiupe

    Joined:
    Feb 1, 2013
    Posts:
    528
    We use Spine too but still not try this new animation system. Not sure it can compare to Spine right now seems to go in the right direction.
     
  3. sehathesam

    sehathesam

    Joined:
    Jan 19, 2016
    Posts:
    4
    New Animation 2D (performance Problem)

    hi
    today I wanted to use new animation 2d in unity 2019.2.1f
    I create the enemy by the new animation 2D
    I have the pooling system and I initialized the pooling system by 10 enemies.
    when the enemy is enabled I got drop frame

    in SpriteSkinEntity class OnEnable() function have some performance problem

    https://drive.google.com/open?id=1mb5Z66xK1_gyLfWdG816yUBffEZp38gM

    thanks
     
  4. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    173
    Questions about "Swapping Sprite Library assets"
    -Do I really understand correctly that for each added skin that we want to change through replacing the sprite library, it will be necessary to follow the steps described in the documentation:

    3. In the Skinning Editor, assign each part of the characters to a unique Category (for example, create a ‘Left Hand’ category for the ‘left hand’ Sprite, and so on).

    4. Make sure the corresponding Sprite parts in both Prefabs have the same Category name and Label as their counterpart. For example, the head Sprites of both the color and greyscale characters must be in the same ‘Head’ Category and have the same Label

    5. Drag the Prefab for the colorful character into the Scene. In the Inspector window, navigate to its Sprite Library component.


    And only after that, we can replace one library with another?
    And all this must be repeated for each new "skin"? :eek:

    -But this is tons of monotonous, but extremely sensitive to errors work!
    (I know, I checked it - just having done this ... :D :confused:)

    Thus, formally - there is an opportunity to change the skin, but in fact - the current implementation will not allow it to use freely... :(
    But all this time we all so hoped for a simple replacement of the atlas/spritesheet/ new multilayered PSB.. -just graphics from new file!
    Well ... dreams did not come true...
    1-109-128.png
     
    Last edited: Aug 2, 2019
    CoCoNutti and Betzalel like this.
  5. EvOne

    EvOne

    Joined:
    Jan 29, 2016
    Posts:
    173
    What may be wrong with my attempt Frame-by-frame animation?
    When recording animations, sprites in the renderer are lost. And it is impossible to appoint him again in the same frame.
    Resolver perfectly changes sprites without record animation.
    There are no messages in the console.
    FrameAnimation_01.gif
     
    Last edited: Aug 2, 2019
  6. MikaMobile

    MikaMobile

    Joined:
    Jan 29, 2009
    Posts:
    845
    Massive performance regression in 2019.2. I got my crap up and running after manually updating burst to the latest version, and was greeted by a simple scene plummeting to almost 30fps in the editor on my PC. Assuming this is related to the 2D packages, as there's little else going on in this scene. Shall I upload my project with a bug report, or is this a known issue with 2019.2?

    Here's a couple snaps of the profiler, 2019.2.1 vs 2019.1.12... what a mess.
     

    Attached Files:

    Stevepunk and Zepa like this.
  7. sehathesam

    sehathesam

    Joined:
    Jan 19, 2016
    Posts:
    4
    hi
    today I found the Preview.4-2.2.0 published
    the first thing I saw was the removal of the Burst from the dependency list
    my first problem was fixed (GC Problem) but the performance problem persists
    with the addition of an enemy, it drops by about 30 frames
    in SpriteSkin class LateUpdate() function has some performance problem


    https://drive.google.com/open?id=1gndpprZxnUQR61iNwp6Ryld4b-39E_O5

    thanks
     
    Xarbrough and eyee like this.
  8. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    You will need to set the keyframes tangent to constant
     
    EvOne likes this.
  9. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    EvOne likes this.
  10. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Hi, in the PSDImporter, there is a 'Reslice' option that will update the Sprite's rect dimension and maintain the rest of the data.

    In the case of the 'neck' scenario, you will have to redo the geometry since the graphic has change. The other parts should still maintain.
     
  11. RandomCharacters

    RandomCharacters

    Joined:
    Nov 29, 2012
    Posts:
    262
    After upgrading from unity 2019.1.12 to 2019.2.0, there are errors now in the console. It may have to do with the 2d animation preview. I have seen 2 other persons mention this issue. Basically, the console gets errors. When I upgrade to the newest version of the package, another error is given and so on. eventually the errors just keep repeating and the project is useless. It could be the 2d animation or burst or 2d spriteshape or entities. Has anyone has these issues?


    https://forum.unity.com/threads/unity-2019-2-0-bug-issue.719345/

    https://forum.unity.com/threads/unity-2019-2-package-manager-error.720485/
     
  12. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    From the logs in your post https://forum.unity.com/threads/unity-2019-2-0-bug-issue.719345/
    It looks like it's coming from Anima2D and not from the 2D Animation Package.
     
  13. cometa93

    cometa93

    Joined:
    Mar 5, 2014
    Posts:
    41
    And what about performance issues? I use Animation2d as well in Unity 2019.1.10 and really highly optimized game with optimized drawcalls,scripts have less than 40fps on mid devices, when few characters animated with sprite skins are present on the screen.
     
  14. RandomCharacters

    RandomCharacters

    Joined:
    Nov 29, 2012
    Posts:
    262
    OK, great. Now we are getting somewhere. thanks. so how do I fix it? Do I delete anima 2d (is anima 2d needed)? Is unity working on fixing the issue for the next version?

    TEMPORARY SOLUTION?
    I downgraded the burst package in the package manager from 1.1.2 to 1.1.1 . The errors went away. This was using unity 2019.1.14. zzzIs this OK and will Unity look into the issue?
     
    Last edited: Aug 11, 2019
  15. Sumthin

    Sumthin

    Joined:
    Aug 12, 2019
    Posts:
    3
    Is it possible to use something else than PSB file?

    I tried using a PNG file, first with all my layers spread out from each other. The problem is that I couldn't move them around to recompose my character.

    I then tried to just import my character as is. In Sprite Editor I drew as many rectangle as I wanted body parts. Then in Custom Outline for each body part I drew the exact outline I wanted. But now in Skinning Editor I can't seem to add bones for all body parts at once. I can at bones to just the selected body part. Also Bone Influence is always grayed out. Also I don't have the Reparent Bones button, which would allow me to add bones separately to each body part, then link the bones between body parts.

    As all body parts have bones that are not linked to each other, if I move the upper arm, it won't move the forearm.
     
    Last edited: Aug 12, 2019
  16. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429
    Currently it is not immediatly clear which vertex is influenced by which bone.
    I think it must be fixed by coloring vertexes with colors of influenced bones.
    upload_2019-8-12_23-22-56.png
    Also bone select drobdown is too short you can not even see bone index.

    In Spine 2d vertexes are colored this way
    upload_2019-8-12_23-17-1.png

    In DragonBones
    upload_2019-8-13_14-14-31.png

    in Anima 2d
    upload_2019-8-13_14-18-26.png



    Is something like that planned?
     
    Last edited: Aug 13, 2019
    Sam_Ooi, Grizmu, CoCoNutti and 2 others like this.
  17. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    With PNG files, you will need to recompose your character from the Scene View. Bones parenting between Sprites has to be done from the SceneView as well. You can follow the following blog post as reference https://blogs.unity3d.com/2018/11/09/getting-started-with-unitys-2d-animation-package/
     
  18. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    It is not at the moment. Thank you for brining this up and we will put it in our back log
     
    facundo_unity961 and TextusGames like this.
  19. Sumthin

    Sumthin

    Joined:
    Aug 12, 2019
    Posts:
    3
    Thanks for the reply, but it seems the UI really changed since the blog post. I was following ANIMATE 2D CHARACTERS in Unity but it was around the time of the blog post and has also changed.
    The 2D Animation info on Github is also not updated making it hard to follow.

    Is there any recent documentation that I could use? FYI I'm using the 2D Animation v2.2.0 preview 4. When I drop my sprite on the Scene View I only see one body part, so I must be doing something wrong.
     
  20. TextusGames

    TextusGames

    Joined:
    Dec 8, 2016
    Posts:
    429
    Thanks. This should be implemented. Because I can not see potential errors with weights without iterating through each vertex and see it manually. And without what I will rather continue to use spine and wait for this to be implemented.

    By the way, your 2d animation package looks promising. Keep improving that until it is competetive with other animation progs. At least Just give us mandatory things and we will use this and will appreciate your work :)
     
    Last edited: Aug 14, 2019
  21. Sumthin

    Sumthin

    Joined:
    Aug 12, 2019
    Posts:
    3
    OK so I was able to make it work. I followed a recent video


    At first I was using a PNG file and thought the PSD Importer was thus not needed, but it seems to be mandatory.

    Was I did was use Gimp to make my character, then export it as PSD (single layer) and renamed the file as PSB.
     
  22. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    After I updated to 2019.2.0f1 I get these errors when I try to animate my new model with Animator:
    Code (CSharp):
    1. ArgumentException: An item with the same key has already been added. Key: -1668340974
    2. System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <a8ed250850854b439cedc18931a314fe>:0)
    3. System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <a8ed250850854b439cedc18931a314fe>:0)
    4. UnityEditor.CurveEditor.set_animationCurves (UnityEditor.CurveWrapper[] value) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/CurveEditor.cs:239)
    5. UnityEditor.AnimEditor.UpdateCurveEditorData () (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs:1290)
    6. UnityEditor.AnimEditor.UpdateSelectedKeysToCurveEditor () (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs:1220)
    7. UnityEditor.AnimEditor.SaveCurveEditorKeySelection () (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs:1239)
    8. UnityEditor.AnimEditor.BeginKeyModification () (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimEditor.cs:1246)
    9. UnityEditorInternal.AnimationWindowControl.BeginKeyModification () (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowControl.cs:1087)
    10. UnityEditorInternal.AnimationWindowControl.ProcessAutoKey (UnityEditor.UndoPropertyModification[] modifications) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowControl.cs:774)
    11. UnityEditorInternal.AnimationWindowControl.PostprocessAnimationRecordingModifications (UnityEditor.UndoPropertyModification[] modifications) (at C:/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/AnimationWindowControl.cs:761)
    12. UnityEditor.Undo.InvokePostprocessModifications (UnityEditor.UndoPropertyModification[] modifications) (at C:/buildslave/unity/build/Editor/Mono/Undo/Undo.bindings.cs:189)
    13.  
    now I cannot work my animations. Any workaround?
     
  23. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    I never got those errros in 2019.1.10. I re-imported the model with no luck.
     
  24. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    87
    I'd been doing some custom scene object arrangement based one the Root Bone (Transform) reference from SpriteSkin, but now it appears that SpriteSkin has been made internal in new versions of the package. Is there another way to find out the root transform being used by a SpriteSkin in the scene? It seems odd to me that SpriteSkin is internal, since it's a visible Component on my game objects.
     
    EvOne likes this.
  25. sehathesam

    sehathesam

    Joined:
    Jan 19, 2016
    Posts:
    4

    hi
    I'm still waiting for an answer on this post
    Thanks
     
    Xarbrough and eyee like this.
  26. MikaMobile

    MikaMobile

    Joined:
    Jan 29, 2009
    Posts:
    845
    I reported a bug on the same thing, acknowledged in another thread. The said they were hoping to address is in the next ~3 weeks if I recall.
     
    eyee, sehathesam and EvOne like this.
  27. sehathesam

    sehathesam

    Joined:
    Jan 19, 2016
    Posts:
    4

    Thanks man
     
  28. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    PSB so buggy when you need to change part of your art and resave it into Unity via Finder (read somewhere that's what your'e meant to do). I'm on sixth redo of all the bones/weights because of it.
     
  29. dquek

    dquek

    Unity Technologies

    Joined:
    Apr 17, 2018
    Posts:
    70
    Have you reported a Bug via Bug reporter yet?
    If we have a small sample project in the bug report, this helps us to debug the issue much faster.
    You can file a bug report with a sample repro project through = Unity > Help > Report a Bug...


    We'll try to repro this issue internally and take a look.
     
  30. giorgos_gs

    giorgos_gs

    Joined:
    Apr 23, 2014
    Posts:
    623
    Deleting the animation and remaking it from the beginning helped. Now its ok.
     
  31. Betzalel

    Betzalel

    Joined:
    Dec 3, 2017
    Posts:
    22
    If I am copy pasting the same skeleton on let's say 4 different PSB files, then dropping those 4 PSBs in an animation at different frames so I have a mixture of sprite and bone animation, will I be causing unnecessary performance cost? I.e. am I loading a new skeleton for each PSB frame change?

    In other words should I stick to animating a character via the sprite swap feature and keep all sprite animations cycling through sprites in the sprite library on the same skeleton? or just save the sprite swap for literally different skins (like armor changes and equipment changes) only and continue to use the first mentioned method?

    An example of why I'm animating this way is: sometimes my characters arm is viewed from side and sometimes its foreshortened viewed in perspective. Just moving the bones and squashing them doesn't give the foreshortening that I want to achieve. So durring animation the arm switches from side view to foreshortened view. BUT to complicate this the characters equipment can (like armor) can totally change the arm sprite in both the side and the foreshortened perspective view.

    In either case if there isn't a way to do it already can there be a way to group let's say for example: all left leg sprites and all head sprites and all torso sprites etc... separately, each sprite in those groups having an ID, then have sub groups for those groups that contain all the possible skin changes for each sprite ID like different armor, equipment etc..? All using the same skeleton rig?

    Unless I'm missing something and that is the way its setup or theres an easier way than what I'm describing I feel that right now I'm confused and also not seeing how the workflow should go for very involved animation.

    One of my characters has a little over 800 sprites for just its base animations. It comes out that way since I have 40 different hand poses and angles, 80 different torso angles and poses etc... the animation is a massive part of the game. There are times when a fist or a boot changes but the rest stays the same... if there is a more graceful way of handling the animation please advise. Or if there is a solution yet to come please consider very involved animation.

    Other than that I'm really loving the work done so far! Thank you so much!
     
    EvOne likes this.
  32. eyee

    eyee

    Joined:
    May 11, 2013
    Posts:
    5
    Do you have a link to the report? Have the same performance problem.
     
  33. breezer

    breezer

    Joined:
    Aug 16, 2017
    Posts:
    2
    I'm not sure that this is what you're talking about but I successfully implemented sprite swapping by replacing the texture of the sprite's material at runtime. Works with simple .PNGs in 2018.3.14f
     
  34. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    We are actually looking into this workflow at the moment. We would love to contact you and take a look at how your visuals are like in this particular case.
     
    EvOne and Betzalel like this.
  35. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    We are looking at the issue at the moment.
     
    Last edited: Aug 23, 2019
    Xarbrough, EvOne, eyee and 1 other person like this.
  36. ice-k

    ice-k

    Joined:
    May 9, 2018
    Posts:
    6
    Where can I get the example project of 2019.2?
     
    Last edited: Aug 28, 2019
  37. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    87
    @dquek or @Leo-Yaik any word on this? For now I'm stuck with copying the source from the package cache into my src directory and removing the internal modifier from the SpriteSkin class. It's far from ideal because it means updates will be a pain and it also requires me to move the PSD package in the same way. Any help would be greatly appreciated.
     
  38. LilGames

    LilGames

    Joined:
    Mar 30, 2015
    Posts:
    570
    Still in Preview, eh?
     
  39. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Do you need this in Editor only or Runtime as well?

    You can do something like this for now

    Code (CSharp):
    1. static class SpriteSkinExtension
    2. {
    3.     static public Transform GetRootBone(this MonoBehaviour mono)
    4.     {
    5.         var type = mono.GetType();
    6.         if (type.FullName == "UnityEngine.U2D.Animation.SpriteSkin")
    7.         {
    8.             var property = type.GetProperty("rootBone", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
    9.             var transform = property.GetValue(mono) as Transform;
    10.             return transform;
    11.         }
    12.         return null;
    13.     }
    14. }
    To use this, reference the SpriteSkin component as a MonoBehaviour and call
    Code (CSharp):
    1. mySpriteSkinReference.GetRootBone();
     
  40. hidingspot

    hidingspot

    Joined:
    Apr 27, 2011
    Posts:
    87

    I only need it in the editor. I was already using reflection for the rootBone property, since that wasn't previously public anyway, but that's a creative hack using c# extensions like that to get the type without specifying it. It actually made me realize GetComponent with the string parameter will also do the trick in my case. Thanks for the help!

    That being said, are there plans to remove the internal flag on SpriteSkin once the package comes out of experimental? Is there a good reason to keep it from being extendable or referenced? In the end, I'd rather not have to use reflection.
     
    EvOne likes this.
  41. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Yes, we will consider exposing APIs and classes when there are valid use cases for it. We will backlog it and potentially get it out in next couple of releases.
     
  42. cometa93

    cometa93

    Joined:
    Mar 5, 2014
    Posts:
    41
    Ok, I will ask my question one more time...By the way, I feel like you are blind for what I'm writing. What about performance issues, for what the hell it was transferred to ECS when the plugin is not optimized at all...I didn't saw any impact after the transfer, what is more, I only had to re-create every animation.

    From my experience, when writing some reusable plugins, tools or engine parts ( i have my own library shared by every game of mine) it's super important to have a view on performance all the time... Currently, my project is not able to be released, only because I had faith in your 2D animation product ( wrong decision of mine ). Guys, I have like 4 NPC's walking around the screen. Whenever they enter the screen there is a lag and lost in fps... I will say it one more time... 4 NPC's ( 1 draw call ), with animator and 2d animation.

    Have you did any progress under this issue from my last message? I'm not the only one struggling with it...

    Edit: I must say I'm thinking of using a spine or anima2d... As even if I try to support you... you don't give a damn about my reports, pushing only more features without fixing what you have did good in the first.
     
    sehathesam likes this.
  43. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    We are already working on improving the performance and it will be out with the next release. We are currently targeting to release it next week.
     
  44. cometa93

    cometa93

    Joined:
    Mar 5, 2014
    Posts:
    41
    Nice to hear, waiting for this really much and appreciate!
     
  45. URocks

    URocks

    Joined:
    May 1, 2014
    Posts:
    159
    It is possible to access deformed mesh or verticles on a current frame from Sprite Renderer or Sprite Skin from a script? I tried everything, but without luck :-( From SpriteRenderer.sprite.vertices I am always getting not deformed verticles even if they are deformed by bones
     
  46. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    No, we did not expose the API to do so. Can you tell us your use case?
     
  47. URocks

    URocks

    Joined:
    May 1, 2014
    Posts:
    159
    Use case is to create 2d edge or poly colider on current frame. I am using deformed sprite as soft body, but other sprites cant colide with it properly because i cant get the current vert positons. So i cant pass the edge vericles to 2d edge or poly collider. Do you think you can expose it? Thank you
     
  48. rafaelferrari1

    rafaelferrari1

    Joined:
    Jan 6, 2014
    Posts:
    8
    Hey!

    I would like to check if this update was released?

    I'm currently working in a game, where we are having the same kind of performance issues, specially on Mesh.Deform calls. Is really slowing down our game.

    We have tested the last version of 2dskinning on Package Manager, and also at Unity 19.3 beta. The result are kind of the same.

    Do you guys have some tip or something we can do for a better result?

    We can share more information about the project, for test proposes too!

    Here is couple of information from our game:
    https://twitter.com/SkullfishVR/status/1169976328197672962
    https://twitter.com/SkullfishVR/status/1174322182333358082

    Thanks!
     
  49. Leo-Yaik

    Leo-Yaik

    Unity Technologies

    Joined:
    Aug 13, 2014
    Posts:
    436
    Hi, Animation 2D 3.0.5 just went live for Unity 19.3. To take advantage of the new performance improvement in 3.0.5, you will need to install the Burst package.

    Note that the current performance improvement is targeted at deforming the Sprites i.e. if you have alot of bones but with simple Sprite meshes, you probably won't see the performance improvement.

    We will continue to work on this to bring better performance.

    For users who are using 19.2, hang tight, it's coming soon!
     
    EvOne and Zepa like this.
  50. MikaMobile

    MikaMobile

    Joined:
    Jan 29, 2009
    Posts:
    845
    So to clarify, this doesn't eliminate the zillions of independent LateUpdate() calls for every sprite? If we have lots of bones we're still going to tank our FPS?
     
Thread Status:
Not open for further replies.