Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Crashes with animation overrides in 5.2?

Discussion in 'Animation' started by JohnnyA, Sep 11, 2015.

  1. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,004
    In 5.2 samples from Platformer PRO (an asset of mine) are crashing the editor when they set the animation override. To make it even more confusing its intermittent (sometimes it occurs instantly on setting the animation override, other times after a second or two).

    In the times where the bug isn't thrown restoring the original animator has no effect (the overriden animations continue to play).

    I'm working on extracting a simple repeatable test case but am wondering if anyone had seen this and had any ideas for resolution (or a repeatable test case and bug number I can reference when I contact Unity support).

    Code causing the issue:
    Code (csharp):
    1.  
    2.             if (args.OverrideState != null && animationStateOverrideLookup.ContainsKey(args.OverrideState))
    3.             {
    4.                 AnimatorStateInfo info = myAnimator.GetCurrentAnimatorStateInfo(0);
    5.                 myAnimator.runtimeAnimatorController = animationStateOverrideLookup[args.OverrideState];
    6.                 if (state != AnimationState.NONE)
    7.                 {
    8.                     myAnimator.Play(state.AsString(), 0, info.normalizedTime);
    9.                 }
    10.             }
    11.             else if (args.OverrideState == null)
    12.             {
    13.                 AnimatorStateInfo info = myAnimator.GetCurrentAnimatorStateInfo(0);
    14.                 myAnimator.runtimeAnimatorController = defaultController;
    15.                 if (state != AnimationState.NONE)
    16.                 {
    17.                     myAnimator.Play(state.AsString(), 0, info.normalizedTime);
    18.                 }
    19.             }
    20.  
    If I remove the myAnimator.runtimeAnimatorController = lines then everything works fine (minus no animation override).
     
  2. osuen

    osuen

    Joined:
    Aug 14, 2015
    Posts:
    1
    Have the exact same problem.
     
  3. lazloring

    lazloring

    Joined:
    Feb 18, 2014
    Posts:
    6
    I was running into the same issue and just found a workaround.

    Before changing the runtimeAnimatorController just disable the animator, then re-enable it after it is updated.

    I.E.

    animator.enabled = false;
    animator.runtimeAnimatorController = rac;
    animator.enabled = true;

    Hope this helps :)
     
  4. TheDelhiDuck

    TheDelhiDuck

    Joined:
    Aug 29, 2014
    Posts:
    29
    Same issue here, unfortunately that solution didn't work for me though.
     
  5. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    Man, I just spent the last couple of hours trying to find out why the editor was crashing, only to find out that I'm also having this exact same problem. The following line for me crashes the editor:

    animator.runtimeAnimatorController = animOverrideController;

    Disabling and then enabling doesn't work for me either. @JohnnyA have you filed a bug report yet?
     
  6. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,004
    Hi all, sorry wasn't watching this thread.

    I have not raised a bug as yet, rather busy at the moment. But if no one else has raised one, I'll do so on the weekend when I have some time to create the test case.

    - John A
     
    Last edited: Sep 22, 2015
  7. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    Bug was already filed and a fix is already available in the next patch release which should be released this week.

    Thanks guys.
     
  8. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,004
  9. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    5.2.1 not fixed.Will fixed in 5.2.1p1 ?
     
  10. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,061
    I've submitted 2 crashes in one report: Case 726627(nice number :)),with reproes for both. One of the crashes is related to assigning an override controller, which doesn't have a controller to override.
    Both in 5.2.0p1 and 5.2.1 there is this fix:
    • (722058) - Mecanim: Fixed a crash when setting an Override Controller with no controller to override.
    However it doesn't fix my crash. Is this the fix @Mecanim.Dev mentioned or is there a 5.2.1p1 coming this week with another fix?
     
  11. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    @Mecanim.Dev Still happens with the latest patch released today: 5.2.1p1
     
  12. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    Still Happens in 5.2.1p1.
     
  13. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    If you can repro the bug in 5.2.1p1, please log another bug with your project, you may have something different in your setup.
     
  14. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    I just submitted a bug report which includes a simple project which shows the crash when trying to swap animations at runtime using an override controller in 5.2.1p1:

    731237

    Thanks.
     
    JohnnyA likes this.
  15. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    Is 5.2.1p2 fixed?
     
  16. ClaudioFreda

    ClaudioFreda

    Joined:
    Nov 16, 2013
    Posts:
    7
    Bug is fixed for me in 5.2.1p2
     
  17. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    We have found two incarnation of the same crash. the first one was fixed in 5.2.1p2 and the second one found by @Korindian was fixed this week so it should be available in the next patch release
     
    Korindian likes this.
  18. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    Thank you.
     
  19. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    Last edited: Oct 10, 2015
  20. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    In 5.2.1p3 aways crash on set runtimeAnimatorController:
    Code (JavaScript):
    1. Receiving unhandled NULL exception
    2. Launching bug reporter
    3. Obtained 49 stack frames.
    4. #0  0x0000010200c1d2 in AnimatorControllerPlayable::GenerateGraph()
    5. #1  0x00000101fae2e6 in Animator::SetRuntimeAnimatorController(RuntimeAnimatorController*)
    6. #2  0x00000102070cbd in Animator_Set_Custom_PropRuntimeAnimatorController(ReadOnlyScriptingObjectOfType<Animator>, ReadOnlyScriptingObjectOfType<RuntimeAnimatorController>)
    7. #3  0x00000127dd602a in  (wrapper managed-to-native) UnityEngine.Animator:set_runtimeAnimatorController (UnityEngine.RuntimeAnimatorController) + 0xfa (0x127dd5f30 0x127dd6059) [0x115c00660 - Unity Child Domain]
    8. #4  0x00000127dd4a94 in  CharacterEquipmentController:RenderEquipmentByPart (EquipmentVO,int) + 0x7d4 (0x127dd42c0 0x127dd4b52) [0x115c00660 - Unity Child Domain]
    9. #5  0x00000127dd0da4 in  CharacterEquipmentController:RenderEquipment (HeroVO) + 0x1f4 (0x127dd0bb0 0x127dd0e0c) [0x115c00660 - Unity Child Domain]
    10. #6  0x00000127dd09a6 in  RoleAnimationController:BindRoleBodyWithClassId (RoleInfoDataSource) + 0x286 (0x127dd0720 0x127dd0b8a) [0x115c00660 - Unity Child Domain]
    11. #7  0x00000127dcf6a8 in  RoleAnimationController:LoadRoleModel (bool,RoleInfoDataSource,int) + 0x6c8 (0x127dcefe0 0x127dcf6f1) [0x115c00660 - Unity Child Domain]
    12. #8  0x00000127dcedf5 in  PlayerNavAgent:LoadPlayerModel (bool,HeroVO) + 0x95 (0x127dced60 0x127dcee19) [0x115c00660 - Unity Child Domain]
    13. #9  0x00000127dcebe0 in  RoleAI:LoadModel (bool,HeroVO) + 0x1f0 (0x127dce9f0 0x127dcec4b) [0x115c00660 - Unity Child Domain]
    14. #10 0x00000127dcae89 in  RoleLoadManager:LoadPlayer (bool,UnityEngine.Vector3,HeroVO) + 0x169 (0x127dcad20 0x127dcaeb1) [0x115c00660 - Unity Child Domain]
    15. #11 0x00000127dbf54c in  GameManager:LoadPlayers () + 0x6dc (0x127dbee70 0x127dbf8c4) [0x115c00660 - Unity Child Domain]
    16. #12 0x00000127da8682 in  GameManager:AfterInitialize () + 0x832 (0x127da7e50 0x127da87de) [0x115c00660 - Unity Child Domain]
    17. #13 0x00000127da7db0 in  GameManagerLoader:OnAllModuleInitDone (DynamicModuleManager) + 0x60 (0x127da7d50 0x127da7dd4) [0x115c00660 - Unity Child Domain]
    18. #14 0x00000127c7b0a6 in  SceneController:Init (string) + 0x406 (0x127c7aca0 0x127c7b1ad) [0x115c00660 - Unity Child Domain]
    19. #15 0x00000127c7abe7 in  SceneController:Awake () + 0x97 (0x127c7ab50 0x127c7ac68) [0x115c00660 - Unity Child Domain]
    20. #16 0x0000011ef4387a in  (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0xfa (0x11ef43780 0x11ef439ad) [0x115c00660 - Unity Child Domain]
    21. #17 0x00000109c766d0 in mono_get_runtime_build_info
    22. #18 0x00000109d9a7b3 in mono_runtime_invoke
    23. #19 0x0000010107642a in ScriptingInvocation::Invoke(MonoException**, bool)
    24. #20 0x00000101077067 in ScriptingInvocationNoArgs::InvokeChecked()
    25. #21 0x00000101055be1 in MonoBehaviour::CallMethodInactive(ScriptingMethodMono)
    26. #22 0x00000101059841 in MonoBehaviour::AddToManager()
    27. #23 0x00000101107887 in AwakeFromLoadQueue::InvokePersistentManagerAwake(AwakeFromLoadQueue::Item*, unsigned int, AwakeFromLoadMode, UnityGUID const&)
    28. #24 0x00000100f5bf35 in LoadSceneOperation::CompleteAwakeSequence()
    29. #25 0x00000100f5b35c in LoadSceneOperation::IntegrateMainThread()
    30. #26 0x00000100f5796c in PreloadManager::UpdatePreloadingSingleStep(PreloadManager::UpdatePreloadingFlags, int)
    31. #27 0x00000100f58310 in PreloadManager::WaitForAllAsyncOperationsToComplete()
    32. #28 0x00000100cbdf19 in SceneManager::LoadScene(UnityStr const&, UnityStr const&, int, SceneManager::LoadingMode)
    33. #29 0x000001019a95a4 in Application::LoadSceneInternal(std::string const&, TransferInstructionFlags, std::map<long long, int, std::less<long long>, std::allocator<std::pair<long long const, int> > >*)
    34. #30 0x000001019ac1d6 in Application::EnterPlayMode(bool)
    35. #31 0x000001019a65e8 in Application::SetIsPlaying(bool)
    36. #32 0x000001019a60f7 in Application::TickTimer()
    37. #33 0x007fff9230d2e0 in __NSFireTimer
    38. #34 0x007fff90dcbc84 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
    39. #35 0x007fff90dcb913 in __CFRunLoopDoTimer
    40. #36 0x007fff90dcb46a in __CFRunLoopDoTimers
    41. #37 0x007fff90dc2961 in __CFRunLoopRun
    42. #38 0x007fff90dc1fc8 in CFRunLoopRunSpecific
    43. #39 0x007fff8dcffd55 in RunCurrentEventLoopInMode
    44. #40 0x007fff8dcffa97 in ReceiveNextEventCommon
    45. #41 0x007fff8dcff9cf in _BlockUntilNextEventMatchingListInModeWithFilter
    46. #42 0x007fff8f370d96 in _DPSNextEvent
    47. #43 0x007fff8f3701c5 in -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
    48. #44 0x007fff8f364d28 in -[NSApplication run]
    49. #45 0x007fff8f32dfbe in NSApplicationMain
    50. #46 0x00000101bee616 in EditorMain(int, char const**)
    51. #47 0x00000101beee69 in main
    52. #48 0x00000100002354 in start
    53.  
     
  21. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    This look like another crash, please report a bug
     
  22. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    @Mecanim.Dev It looks like my bug is still present in 5.2.1p3. I'm guessing it will be in the next patch release this week? Thanks.
     
  23. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    @Mecanim.Dev Crash still present in 5.2.2 released today. Case 731237
     
  24. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    Hi Korindian,
    the bug is not yet fixed
     
  25. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    5.2.2p1 still not fiexd.
     
  26. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    5.2.2p2 still have this problem.
     
  27. lucks17

    lucks17

    Joined:
    Jan 20, 2014
    Posts:
    9
  28. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
  29. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    the bug is not yet fixed in 5.2.x but should be fixed in next 5.3 Beta, so as soon as we get QA approval for this bug it will be backported to 5.2
     
  30. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    Ok,thanks.
     
  31. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    @Mecanim.Dev
    Why have not been fixed in Unity 5.3 released version?
     
  32. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,674
    if you still have the same crash in 5.3 then it probably another bug.
    please log a bug with your project and we will fix it
     
  33. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    Just if a GameObject or it's parent is activeSelf=false ,editor will crash when change the runtimeAnimatorController.
     
  34. v.nikolaev

    v.nikolaev

    Joined:
    Sep 11, 2015
    Posts:
    7
    Reproduced this crash in unity 5.3.0f4, submited a bug with name:
    "752642 Unity crashed during creating animator override controller in runtime"
     
  35. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    Even Unity 5.3.1 and 5.3.1p1,I should to check gameObject is active before change animator override controller.
     
  36. ephemeral-life

    ephemeral-life

    Joined:
    Sep 12, 2015
    Posts:
    488
    I have to set the current controller to null before applying the override controller:

    public Animator animator;

    animator.runtimeAnimatorController = null;
    animator.runtimeAnimatorController = overrideController;
     
  37. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    @Mecanim.Dev The issue number 731237 is still present in the latest version 5.3.1p3. It is marked as closed but I test it in every new release and Unity always crashes.

    I can confirm the workaround posted by @ephemeral life , that when setting it to null first and then assigning the overrideController, there is no crash.

    Other than using the override controller, is there any other way of replacing animation clips at runtime?
     
  38. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    575
    Found this in patch 5.3.2p2:
    • (731237) - Mecanim: Fixed changing Animator.runtimeAnimatorController while running crashes editor.
    Just tested it and can confirm that it is indeed fixed. No need for the workaround by assigning to null first. Thank you!
     
  39. ephemeral-life

    ephemeral-life

    Joined:
    Sep 12, 2015
    Posts:
    488
    Cool. Thanks for sharing.
     
  40. AFrisby

    AFrisby

    Joined:
    Apr 14, 2010
    Posts:
    216
    Can confirm another instance - also can confirm the workaround by @ephemeral life works for us too. (Case#768657)
     
  41. fishg

    fishg

    Joined:
    Jul 25, 2014
    Posts:
    90
    Fine.I can change runtimeAnimatorController with gameObject not active without crash.
     
unityunity