Search Unity

Animation/Animator Problems

Discussion in 'Animation' started by Yearl, Jul 2, 2015.

  1. Yearl

    Yearl

    Joined:
    Jun 26, 2015
    Posts:
    33
    Hi,
    New problem come with the latest version of unity in my game ...

    That error appear in mass when i create some new sprites animations :
    "AnimationModeSnapshot.AddPropertyModification may only be called in animation mode"

    And some times an other one .

    And then when I modify components of a sprite with animations, all modifications are added to the animation curve even if I'm not in rec mode ...
    Sometimes sprites totally desapear ..etc..
    I'm working on unity since 4 years and never have this problem before.

    Thanks for help.

    (I'm also allowed to skype if anyone want to see the problem in realtime)

    EDIT:: The other console bug:
    NullReferenceException: Object reference not set to an instance of an object
    UnityEditorInternal.AnimationRecording.Process
     

    Attached Files:

    Last edited: Jul 3, 2015
    HalversonS likes this.
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    HI,

    Sounds like you may be doing something funky to create your animations.
    Can you post a snippet of your code showing how you create the sprite animations?
     
    HalversonS likes this.
  3. Yearl

    Yearl

    Joined:
    Jun 26, 2015
    Posts:
    33
    Hi,
    I only create animations with with the "Animation" and "Animator" windows, nothing create with code :/
     
    HalversonS likes this.
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    HalversonS likes this.
  5. Yearl

    Yearl

    Joined:
    Jun 26, 2015
    Posts:
    33
    Huu .. My project is 2Go and my network connection will takes 1week to upload it.
    Thx anyway :/

    I find a temporary solution:
    make an animation then close unity and reopen before modify other components of the sprite.

    SO, thinking that the editor don't refresh correctlly and continuing rec even if rec button is off ?
     
    HalversonS likes this.
  6. dmitsuki

    dmitsuki

    Joined:
    Apr 13, 2013
    Posts:
    4
    Hi,
    I'm currently having the same issue. The easiest way to reproduce it would be to make a new project, download the "unity-chan" assets off of the asset store, add the prefab to the scene, preview an animation with the animation window in scene view, then add an empty game object to the root gameobject of the Unity-chan prefab.

    I am uploading my current project right now, but it's 1.5 gigs so it could take a while. Doing what Yearl did as the "quickfix" worked for me as well, but I'd rather not have to reopen the editor every time...

    Edit
    Upload is complete, just waiting for the email to give me anymore information you need me to post.

    Edit.edit
    case number (Case 711082)
     
    Last edited: Jul 9, 2015
    HalversonS likes this.
  7. jherbold

    jherbold

    Joined:
    Jul 16, 2015
    Posts:
    3
    I'm running into this same issue as well. Basically, even though recording mode is off, modifications made in the scene will be added to the animation clip, and the error will appear in the console.

    I've noticed that a script recompile will fix it for a time. My best guess is that something isn't cleaned up when exiting animation mode, but is cleaned up when recompiling scripts.

    I've tried explicitly calling AnimationMode.StopAnimationMode(), and even AnimationMode.EndSampling(), but neither worked to fix whatever is leaking.
     
    HalversonS likes this.
  8. jherbold

    jherbold

    Joined:
    Jul 16, 2015
    Posts:
    3
    I think I have a solid repro:

    1. While working on an animation (in record mode), save the scene.
    2. Record mode should turn off automatically.
    3. Make a modification in the scene while record mode is off.
    4. That modification will be added to the animation, and a single error message will appear.
    5. Turn on record mode, save the scene. Record mode will automatically turn off. Repeat multiple times.
    6. When making a modification when record mode is off, you will see 1 error message for each time you saved the scene while in record mode.

    This tells me that some event is registered when entering record mode, but when saving the scene to turn off record mode, that event is not unregistered.
     
    HalversonS likes this.
  9. weswpc

    weswpc

    Joined:
    May 14, 2015
    Posts:
    4
    Also getting this error cropping up. In my case I was experimenting with animating uGUI elements, namely the "Anchored Position" property on a Text object. Seems to happen after multiple changes and saving scene, as detailed above.
     
    HalversonS likes this.
  10. AdamLiu

    AdamLiu

    Joined:
    Mar 19, 2014
    Posts:
    71
    Yeah, I am having the same problem..Thx for the bug report, hope they fix it soon... It's really annoying
     
    HalversonS likes this.
  11. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    HalversonS likes this.
  12. timmy2702

    timmy2702

    Joined:
    Mar 14, 2015
    Posts:
    3
    @karl.jones
    I have the same problem with them. Apparently, the Animation Window from Unity isn't completely turned off when you close it. I have to restart the Unity in order to work normally when moving stuff.

    However, doing animations is a pain since whenever I move sth, it will be recorded even though the Animation Window is closed. I don't think submitting repro will help you at all. This bug is from the current Unity Editor patch. Please check and fix it! I'm pretty sure that the problem is coming from the Animation Window and its behaviour.
     
    HalversonS likes this.
  13. THaynes

    THaynes

    Joined:
    Jul 15, 2014
    Posts:
    1
    Also having these issues, both the saving adjustments when recording is off and laggy adjustments while rec is on. Moving anything while rec is off is generally smooth (as is should be), but brings up that "AnimationModeSnapshot only called in anim mode." error each move.
     
    HalversonS likes this.
  14. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    Ah! Finally! Trying to find an answer to this has been painful. I stumbled upon this thread after receiving snapshot errors because I thought saving was actually helping prevent the issue (it was not).

    This issue occurs even when the user is not constantly saving the scene. I asked the answer community a few weeks back (here) but got no answers or speculation.

    Glad this is being looked at.

    Edit: I should also mention, I believe the errors caused with the above listed bugs are also causing the undo command to not function properly. I have to look at it more though to be certain.
     
    Last edited: Jul 29, 2015
  15. nomadic

    nomadic

    Joined:
    Mar 4, 2010
    Posts:
    44
    I was also having this problem and it seems to be caused by having the guilty Animation component linked as a reference in the inspector. Removing the public inspector reference to the Animation component and assigning it in code instead seems to prevent the errors.
     
    HalversonS likes this.
  16. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    I'm not able to assign these all in code. I just don't have that time.

    This is actually extremely deprecating. I just started going back through animations and found 60 some improperly added components.. I see "Play Animation" key frames added improperly the majority of the time. There are quite literally over 1,200 components in our software. Of each some have several animations. This was a 6 month deadline and I find out that all the states on these objects could be incorrect a two weeks from completion.

    After I turn off record and switch to another (not even a child) object it should not be adding key frames to an animation on a separate object that is no longer selected.

    Needless to say I am very disappointed with Unity. I don't understand how an error like this could have been published.
     
  17. nomadic

    nomadic

    Joined:
    Mar 4, 2010
    Posts:
    44
    Actually, after working for a while the issue popped up again so the inspector was not the cause. Relaunching Unity fixes it for me but I haven't been able to reproduce the problem yet.
     
    HalversonS likes this.
  18. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    The issue appears to be when the animation tab is docked. Having it as a separate window isn't yielding the same complications.

    Easy replication steps.

    1. Dock animation tab.
    2. Select object with animation.
    3. Select Inspector
    4. Select different animated object.
    5. Select animation tab.

    Notice how now the object that was just selected shows missing animations.
    Also if record was previously active before switching to Inspector actions may be recorded to the previous object (still not 100% on replicating recorded actions).
     
  19. nomadic

    nomadic

    Joined:
    Mar 4, 2010
    Posts:
    44
    @HalversonS I tried your steps but it is not reproducing for me.
     
    HalversonS likes this.
  20. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    Are you using animator or animation? If using animation, does anything appear incorrect?
    I get it to occur even with a fresh launch.
    My Animation tab is docked next to my inspector tab.

    Try selecting the first object after clicking on the docked animation tab. After selecting it and seeing it's key frames appear then select inspector with the same object selected. Select a new object. Select the docked animation tab.

    Do you see anything yellow? Both objects must have animations.
    Checked for Updates... Unity says I have latest version.
     
  21. nomadic

    nomadic

    Joined:
    Mar 4, 2010
    Posts:
    44
    Yes, using Animation. I tried with the window docked and docked in background.

    I have seen the properties appear in yellow but not from the same steps you are making. I'm wondering if it is a bug in the .anim file. If you create a new animation, do your steps still repro the problem?
     
    HalversonS likes this.
  22. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    Yeah they do with a new animation as well. However, creating a fresh animation seems to cause the issue to happen even when not docked... :( Really hoping I found a way to plug away at this without these issues. At least if it isn't docked you notice it happening instead of it taking place in the background.

    I get them to appear yellow as well using other steps. The steps I took were giving it to me 100% of the time while the window is docked. Seems like a lower frequency with the window undocked but just happened to me a couple minutes ago.

    It won't be as devastating as long as I see it happening. So no docking for me :p I started getting hundreds of issues back from QA and most are related to "Play.Automatically" slipping into an old animation after creating a new anim on a separate object. (I am turning off Play Automatically on each fresh creation, as for some reason Play Automatically is on by default... just a dev choice though, so it's keyframing that on a previous animation even though RECORD is off). Also moving things is recorded sporadically following the same procedure.

    Sorry I don't have any more info. If something pops up and is 100% or higher frequency I'll drop the info here. Hope it helps!
     
    nomadic likes this.
  23. thexdd

    thexdd

    Joined:
    Mar 20, 2013
    Posts:
    20
    Please fix this issue ;_; its really annoying as hell....
     
    HalversonS likes this.
  24. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    Agreed, it's reeeally effecting workflow.
     
  25. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    Bump.
    Any new info on this? Is anyone working on this?
    All my work for animations is pretty much double while this bug is present.
     
  26. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    I've upgraded to 5.1.2f1 and it still happens.

    To recreate, save a new scene, select a sprite in the scene, make sure it has an animator on it, and some animations in it, and select one of the animations from the clip dropdown in the Animation window.

    scrub the timeline in the Animation window, change a value of the sprite, and hit ctrl+s to save the scene. then, (when the animator shouldn't be in rec mode) change another value on the sprite. It adds a keyframe, and changes the value outside of the animation, and throws the error.

    When you're working with a project that uses over 8000+ sprites and counting, issues like this aren't just annoying; they're blocking. The issue also causes keyframes to be set in the Animation window when it's not in REC mode.

    Anyways, I hope my info helps!
     
    nomadic likes this.
  27. Koth

    Koth

    Joined:
    Jul 11, 2015
    Posts:
    3
    I am having the exact same problem. Additionally, when changing an animation curve using the inspector, there is a considerable amount of time where the editor seizes up and I have to wait for it to finish before continuing. This did not happen before I upgraded to unity 5.1.

    I hope there will be a fix for this issue soon!

    Edit: I think for myself, the bug starts occurring after I save during record mode.
     
    Last edited: Aug 14, 2015
    tonycoculuzzi likes this.
  28. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    To be completely honest, the Animation Editor (not the Animator, the dope sheet/curve editor. The Animator is a completely different story) has been incredibly broken since 5, but it keeps getting worse with every update. Other problems include:
    • Animation Events not firing if a frame is skipped (due to lag, etc)
    • Animation Events don't count as part of the animation anymore, so if an Event exits after all the frames are finished playing, the Event is never fired. Before 5, the Events counted as part of the animation timeline. This was useful functionality, but was removed for some reason. (We needed to go through and fix almost every animation in Cuphead because of this.)
    • Animation frames in the dopesheet not updating or changing when using the copy/paste functionality. Random occurrence.
    • When adding a sprite to the timeline, often times it won't change the sprite it overwrites. Again, random occurrence.
    • Dragging multiple frames to the timeline sometimes causes duplicate frames (example: instead of 1,2,3,4 it ends up adding to the timeline as 1,2,2,4) Another random occurrence.
    • Selecting and moving frames sometimes seizes up editing of that animation clip, until a new clip is selected from the dropdown. Also completely random.
    • Selecting and moving frames shows them as moved, but when returning to that clip you'll notice they haven't been moved. Again, completely random.

    The worst part is that most of these problems are completely random. There's no way to work around them, because there's no way to tell when they're going to happen. Oftentimes I find myself re-doing an animation 2 or 3 times, or having to go back and fix an animation that I didn't realize was broken after creating it.

    It's getting harder and harder to use the animation timeline, which is a real shame. I really hope someone from Unity sees this, because getting these issues fixed as soon as possible would be a huge help.
     
  29. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Hi tonzie,

    I would like to get more detail on your two first issue

    Could you send us some repro step or a project showing both issues?
     
  30. adamgryu

    adamgryu

    Joined:
    Mar 1, 2014
    Posts:
    188
    I haven't had problems with animation events ("phew, since I depend on them in a few situations"), but most of those random occurrence things have happened to me as well.

    I would also like to see a fix for the animation editor. It's an incredibly useful tool, but these problems are making me really frustrated.
     
  31. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,052
    I have been experiencing this as well, just recently. It's not a single project, most of them encounter it at some point. Restarting unit usually fixes it, but it is a major hassle as a mostly building animations at the moment.
     
  32. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    I find that, if there's lag, animation events will not be called if their frames were skipped.

    For example, in my case, we're using very large sprites, in large sprite atlasses. However, if I turn off atlassing, the game will lag for a short while at the beginning of every scene until all the frames are properly loaded. During this time (or any time that there is lag that causes the animation to skip frames) the animation events that were on skipped frames seem to be skipped as well. The Animation Event system seems extremely unreliable at the moment, especially when you're using a lot of animation events to transition to other states, or update your object in some way.

    As for the second one, just try creating an animation event on a sprite animation timeline, and move the event a few frames past the last keyframe in the animation. That event will no longer be fired. In Unity 4, that animation event would have acted as a keyframe, causing the animation to play until the animation was fired, in which the animation would loop or continue, etc.
     
  33. der_r

    der_r

    Joined:
    Mar 30, 2014
    Posts:
    259
    Experiencing it as well in my current project. It's a big hassle because I'm working on bosses for my game that require a lot of animations. I'm closing and restarting Unity many times per hour.
     
  34. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Good news we have now fixed the problem with the animation window still recording after saving. Fix should be in the next possible patch release. I'll post here when it comes out.
     
    theANMATOR2b, HalversonS and der_r like this.
  35. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    This is not expected, the animation length should be updated correctly when you set an animation events past the last key.
    I've just did a quick test in 5.2 and this is still working.
    Could you log a bug with with a small repro and your unity version
     
  36. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    Sure, next time I'm working on a small project where I see this issue I'll make sure to log a bug!

    Any news on the skipped-frame-events-not-firing bug? That's the most annoying of the bunch, and the hardest to deal with.
     
  37. Campbellmalaika

    Campbellmalaika

    Joined:
    Aug 27, 2015
    Posts:
    1
    Incredible post
    Can you post a snippet of your code showing how you create the sprite animations?
    Thanks
     
  38. HalversonS

    HalversonS

    Joined:
    Jan 24, 2014
    Posts:
    28
    Thank you!!!
     
  39. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    This is not something we are aware off and this is unexpected too.
    The way animation event work is really simple, when unity call an Animator.Update we do keep the current time and on the next Animator.Update we do fire all events that are in the range previous time to current time, so even if we do skip a few frame on the next update all animation events that were not fire should be fire.

    Could you log a bug with your project?
    Thanks
     
  40. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    Oh, interesting. That was my suggested fix hahaha. Is it possible that this is only reproducible in-editor? Or maybe the bug has to do with whether or not the animation loops before the frame update. For example: If there is lag, and an animation loops back to the beginning before the frame update loop is called (because of the lag) - Just an idea! I could see how that may cause problems.

    I'll submit a bug report next time I see it happening! Thanks for the quick replies.
     
  41. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    is this a similar error that occurs:

    NullReferenceException: Object reference not set to an instance of an object
    at UnityEditor.Graphs.AnimationStateMachine.TransitionEditionContext.BuildNames () [0x00095] in C:\buildslave\unity\build\Editor\Graphs\UnityEditor.Graphs\AnimationStateMachine\TransitionEditionContext.cs:44
    at UnityEditor.Graphs.AnimationStateMachine.TransitionEditionContext..ctor (UnityEditor.Animations.AnimatorTransitionBase aTransition, UnityEditor.Animations.AnimatorState aSourceState, UnityEditor.Animations.AnimatorStateMachine aSourceStateMachine, UnityEditor.Animations.AnimatorStateMachine aOwnerStateMachine) [0x00023] in C:\buildslave\unity\build\Editor\Graphs\UnityEditor.Graphs\AnimationStateMachine\TransitionEditionContext.cs:28
    at UnityEditor.Graphs.AnimationStateMachine.AnimatorTransitionInspectorBase.ComputeTransitionContexts () [0x00068] in C:\buildslave\unity\build\Editor\Graphs\UnityEditor.Graphs\AnimationStateMachine\AnimatorTransitionInspectorBase.cs:125
    at UnityEditor.Graphs.AnimationStateMachine.AnimatorTransitionInspectorBase.OnEnable () [0x00183] in C:\buildslave\unity\build\Editor\Graphs\UnityEditor.Graphs\AnimationStateMachine\AnimatorTransitionInspectorBase.cs:87
    at UnityEditor.Graphs.AnimationStateMachine.AnimatorStateTransitionInspector.OnEnable () [0x00000] in C:\buildslave\unity\build\Editor\Graphs\UnityEditor.Graphs\AnimationStateMachine\AnimatorStateTransitionInspector.cs:58

    ?

    all clips that reference an object which gets this "missing!" error become corrupted... requiring me to basically start all over on all curves/clips....
     
  42. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Internally we keep clip timing as normalize time and each time a clip loop the interger part of the time is increase by one so we always know how many loop the clip has done and we use this information to trigger animation events. So in such case you would get something like previousTime = 0.95 and currentTime = 1.20 so we know that we need to fire all events from 95% to 100% and then 0% to 20%.

    My guess is that maybe your other bug is tricking you, maybe you did put an animation events pass the last key ? and since the clip range is not updated correctly in your build this events is simply ignored.

    if you can repro the bug easily with your project could you log a bug and I will take a look?
     
  43. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Hi tswalk, no this is unrelated, your exception happen only when you edit a transition in the inspector. I think this bug was fixed in 5.2 so you are probably using a 5.1 build?
     
    tswalk likes this.
  44. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,109
    I am... 5.1.3p1
     
  45. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    I'll see if I can get it happening in a new project. If not, I'll submit a bug report with our current project. It's just a hassle right now because the project is so huge.
     
  46. Rodlaiz

    Rodlaiz

    Joined:
    Jul 30, 2013
    Posts:
    38
    Hello everybody,

    I've just installed Unity 5.2 and I'm still struggling with this issue. The animation keeps recording even if the REC button is off and I get the message: "AnimationModeSnapshot.AddPropertyModification may only be called in animation mode"

    Has anybody found a solution to this problem?
     
  47. tonycoculuzzi

    tonycoculuzzi

    Joined:
    Jun 2, 2011
    Posts:
    301
    You're having this problem with Unity 5.2? I thought this was going to be fixed by 5.2, damn.
     
  48. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    Hi guys,
    the fix was made in trunk and will be backported to 5.2 patch-release
     
  49. Rodlaiz

    Rodlaiz

    Joined:
    Jul 30, 2013
    Posts:
    38
    Thanks for the answer, backported to 5.2 patch-release means that the fix will be available on the next update?
     
  50. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    yes on the next patch release