Search Unity

Crash on Animator IsMatchingTarget

Discussion in 'Animation' started by DriesVienne, Dec 20, 2013.

  1. DriesVienne

    DriesVienne

    Joined:
    Jun 22, 2013
    Posts:
    27
    In our project we build our NPC prefabs in AssetBundles.
    When spawning our NPCs, we "WWW.LoadFromCacheOrDownload" the needed bundle, load the prefab and instantiate our NPC.

    After an update to the skinning for a specific NPC was made, spawning this NPC in Editor this way caused the Editor To crash.
    The log revealed this stacktrace:
    Code (csharp):
    1. (0x004AC3D3) c:\buildagent\work\d3d49558e4d408f4\runtime\animation\animator.cpp (1813 + 0xc): Animator::IsMatchingTarget + 0x63
    2. (0x004AEE51) c:\buildagent\work\d3d49558e4d408f4\runtime\animation\animator.cpp (619 + 0x0): Animator::FKStep + 0x111
    3. (0x004AF431) c:\buildagent\work\d3d49558e4d408f4\runtime\animation\animator.cpp (807 + 0x0): Animator::FKStepStatic + 0x41
    4. (0x008D100B) c:\buildagent\work\d3d49558e4d408f4\runtime\threads\jobscheduler.cpp (147 + 0x8): JobScheduler::WorkLoop + 0x9b
    5. (0x008D16DD) c:\buildagent\work\d3d49558e4d408f4\runtime\threads\thread.cpp (40 + 0x9): Thread::RunThreadWrapper + 0x2d
    6. (0x7507336A) (kernel32): (filename not available): BaseThreadInitThunk + 0x12
    7. (0x771B9F72) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x63
    8. (0x771B9F45) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x36
    There is a slight nuance: Since we don't want to rebuild the assetbundles on every change we made, we also added the option to load the prefab straight from the resources folder (Resources.Load) when working in the editor. Spawning the NPC this way causes NO crash, still it was tested with the exact same prefab loaded both from the Assetbundle (crash!) and the resources folder (no crash).

    I find this very peculiar. Any thoughts on what causes this? Any word of a fix?

    Greetings!

    Dries
     
  2. nbilling

    nbilling

    Joined:
    Mar 15, 2014
    Posts:
    4
    I am now getting this exact same issue. It doesn't happen everytime I instantiate the prefab, but it happens consistently in spells.

    I will be working in Unity/MonoDevelop for several hours, periodically building my app and running it in the IDE alongside the executable (so that I can test client/server interaction), and then at some point instantiating an object in the client and/or server will cause them to immediately die (if the IDE is one of those who crashes, then the entire IDE crashes, no exception in debugger). The dump always, 100% of the time, has Animator::IsMatchingTarget() at the top of the stack. Then for some indeterminate amount of time this will continue to occur, sometimes with the server dying, sometimes with the client dying, sometimes IDE, sometimes executable, sometimes both.

    Things I have tried but failed to help:
    - Deleting the build entirely
    - Running the IDE and executable as admin
    - Disable indexing for build and project folder
    - Disable antivirus (Windows Defender) for build and project folder

    Things I have tried that seemed to help:
    - Reimport all assets into new project somewhere else on disk, re-configure to match old project. Althought eventually the same thing happens, so this is not a very good solution.
    - Delete build over and over, play around randomly in Unity, wait some period of time and try again

    This is really making development impossible for me because when I have several hours carved out to work on my app, I may just be blocked until I no longer have any free time. I'd accept anything, even the most onerous workaround would do so that I can make steady progress.

    Can email crash dump if desired (or else I'll upload it if there's some way to do that on here), will provide any scripts/assets/whatever that anybody investigating desires.

    Code (csharp):
    1. >   TNPRH.exe!Animator::IsMatchingTarget() Line 1815    C++
    2.     TNPRH.exe!Animator::TargetMatch(bool matchCurrentFrame) Line 2409   C++
    3.     TNPRH.exe!Animator::FKStep() Line 619   C++
    4.     TNPRH.exe!Animator::FKStepStatic(void * userData) Line 807  C++
    5.     TNPRH.exe!JobScheduler::WaitForGroup(int group) Line 369    C++
    6.     TNPRH.exe!Animator::UpdateAvatars(Animator * * inputAvatars, unsigned int inputSize, float deltaTime, bool doFKMove, bool doRetargetIKWrite) Line 450   C++
    7.     TNPRH.exe!Animator::SetVisibleRenderers(bool visible) Line 985  C++
    8.     TNPRH.exe!Animator::AnimatorVisibilityCallback(void * userData, void * renderer, int visibilityEvent) Line 1007 C++
    9.     TNPRH.exe!EventManager::InvokeEvent(EventEntry * index, void * senderUserData, int eventType) Line 136  C++
    10.     TNPRH.exe!Object::InvokeEvent(int eventType) Line 1109  C++
    11.     TNPRH.exe!Renderer::RendererBecameVisible() Line 110    C++
    12.     TNPRH.exe!Unity::Scene::NotifyVisible(const CullingOutput  visibleObjects) Line 427 C++
    13.     TNPRH.exe!CullScene(SceneCullingParameters  cullingParameters, CullResults  results) Line 235   C++
    14.     TNPRH.exe!Camera::CustomCull(const CameraCullingParameters  parameters, CullResults  results) Line 993  C++
    15.     TNPRH.exe!Camera::Cull(CullResults  results) Line 801   C++
    16.     TNPRH.exe!RenderManager::RenderCameras() Line 89    C++
    17.     TNPRH.exe!PlayerRender(bool present) Line 1565  C++
    18.     TNPRH.exe!PlayerLoop(bool batchMode, bool performRendering, IHookEvent * pHookEvt) Line 2029    C++
    19.     TNPRH.exe!MainMessageLoop() Line 483    C++
    20.     TNPRH.exe!PlayerWinMain(HINSTANCE__ * hInst, HINSTANCE__ * hPrev, char * szCmdLine, int nCmdShow) Line 894  C++
    21.     TNPRH.exe!WinMain(HINSTANCE__ * hInst, HINSTANCE__ * hPrev, char * szCmdLine, int nCmdShow) Line 6  C++
    22.     TNPRH.exe!__tmainCRTStartup() Line 275  C
    23.     kernel32.dll!7784850d() Unknown
    24.  
     
    Last edited: Apr 8, 2014
  3. nbilling

    nbilling

    Joined:
    Mar 15, 2014
    Posts:
    4
    Update: I have found a pretty easy workaround to my instance of this crash. Reimporting (from the Unity editor) the prefabs that cause the crash on instantiation seems to fix it. It's only a temporary fix, and it does require restarting Unity editor after the crash, but it does the trick.
     
  4. Ghosthowl

    Ghosthowl

    Joined:
    Feb 2, 2014
    Posts:
    228
    I am also getting the same thing. It seems to stem from using IK parameters as a script I use that does so seems to cause it. I can't get to the bottom of it, the only way around is to disable said script or try reimporting all of the project. It works sometimes but other times it causes a crash. Usually the crash occurs when building (due to the nature of my project it is impossible to test a playable use case in the editor)

    Here is my error:

    Code (csharp):
    1.  
    2. ========== OUTPUTING STACK TRACE ==================
    3.  
    4. (0x004AD8F3) c:\buildagent\work\d3d49558e4d408f4\runtime\animation\animator.cpp (1813 + 0xc): Animator::IsMatchingTarget + 0x63
    5. (0x004B0341) c:\buildagent\work\d3d49558e4d408f4\runtime\animation\animator.cpp (619 + 0x0): Animator::FKStep + 0x111
    6. (0x004B0921) c:\buildagent\work\d3d49558e4d408f4\runtime\animation\animator.cpp (807 + 0x0): Animator::FKStepStatic + 0x41
    7. (0x008D34EE) c:\buildagent\work\d3d49558e4d408f4\runtime\threads\jobscheduler.cpp (369 + 0x8): JobScheduler::WaitForGroup + 0x10e
    8. (0x004B8C79) c:\buildagent\work\d3d49558e4d408f4\runtime\animation\animator.cpp (450 + 0x58): Animator::UpdateAvatars + 0x1c9
    9. (0x004B9C51) c:\buildagent\work\d3d49558e4d408f4\runtime\animation\animatormanager.cpp (33 + 0x21): AnimatorManager::UpdateFKMove + 0x41
    10. (0x00F654FC) c:\buildagent\work\d3d49558e4d408f4\editor\src\application.cpp (2286 + 0xb): Application::UpdateScene + 0x21c
    11. (0x00F69577) c:\buildagent\work\d3d49558e4d408f4\editor\src\application.cpp (2216 + 0x0): Application::UpdateSceneIfNeeded + 0x37
    12. (0x0100C682) c:\buildagent\work\d3d49558e4d408f4\editor\platform\windows\wineditormain.cpp (336 + 0x0): MainMessageLoop + 0x1c2
    13. (0x0100D5C7) c:\buildagent\work\d3d49558e4d408f4\editor\platform\windows\wineditormain.cpp (848 + 0x0): WinMain + 0xe37
    14. (0x01125C34) f:\dd\vctools\crt_bld\self_x86\crt\src\crt0.c (275 + 0x1c): __tmainCRTStartup + 0x11a
    15. (0x76D9338A) (kernel32): (filename not available): BaseThreadInitThunk + 0x12
    16. (0x77D79F72) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x63
    17. (0x77D79F45) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x36
    18.  
    19. ========== END OF STACKTRACE ===========
    I will try just re-importing the prefab like @nbilling has suggested. Also another workaround for the building (maybe it works for scenes) is to start a new scene just before. Little annoying having to do this each time I want to build.

    EDIT: I finally solved the problem, the solution can be found here.
     
    Last edited: Jul 8, 2014