Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Crash on AnimationClip.SampleAnimation().Unity version: 2018.2.3f1

Discussion in 'Animation' started by guzz, Sep 10, 2018.

  1. guzz

    guzz

    Joined:
    Dec 16, 2012
    Posts:
    5
    Unity version: 2018.2.3f1
    code:

    public class CrashTest : MonoBehaviour {

    public AnimationClip targetAnimClip = null;
    // Use this for initialization
    void Start () {
    if (targetAnimClip != null)
    targetAnimClip.SampleAnimation(gameObject, 0);
    }
    }

    the gameObject is the model in the scene and clip is the model's clip.

    crash log:
    ========== OUTPUTTING STACK TRACE ==================

    0x00000001419EA1B5 (Unity) UnityEngine::Animation::SetBoundCurveFloatValue
    0x00000001419ADFC4 (Unity) AnimationBinder::SetFloatValue
    0x00000001419D80AF (Unity) SampleAnimation
    0x000000014179E7DA (Unity) AnimationClip_CUSTOM_SampleAnimation
    0x00000000330B4469 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.AnimationClip:SampleAnimation (UnityEngine.GameObject,UnityEngine.AnimationClip,single,UnityEngine.WrapMode)
    0x00000000330B41D0 (Mono JIT Code) [C:\buildslave\unity\build\Runtime\Animation\ScriptBindings\AnimationClip.bindings.cs:24] UnityEngine.AnimationClip:SampleAnimation (UnityEngine.GameObject,single)
    0x00000000330B4097 (Mono JIT Code) [D:\Unity Projects\Survival War\Assets\SpriteBakingStudio\CrashTest.cs:11] CrashTest:Start ()
    0x000000000BA074F2 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    0x000007FED9DE671B (mono) [c:\buildslave\mono\build\mono\mini\mini.c:4937] mono_jit_runtime_invoke
    0x000007FED9D38A71 (mono) [c:\buildslave\mono\build\mono\metadata\object.c:2623] mono_runtime_invoke
    0x0000000140C0500A (Unity) scripting_method_invoke
    0x0000000140BFD1C0 (Unity) ScriptingInvocation::Invoke
    0x0000000140BB9108 (Unity) MonoBehaviour::InvokeMethodOrCoroutineChecked
    0x0000000140BB929A (Unity) MonoBehaviour::InvokeMethodOrCoroutineChecked
    0x0000000140BBD667 (Unity) MonoBehaviour::Start
    0x0000000140BB51E9 (Unity) MonoBehaviour::DelayedStartCall
    0x00000001406F1087 (Unity) DelayedCallManager::Update
    0x00000001409687AC (Unity) `InitPlayerLoopCallbacks'::`2'::EarlyUpdateScriptRunDelayedStartupFrameRegistrator::Forward
    0x00000001409680E7 (Unity) ExecutePlayerLoop
    0x0000000140968196 (Unity) ExecutePlayerLoop
    0x000000014096AA3C (Unity) PlayerLoop
    0x000000014144C52A (Unity) PlayerLoopController::UpdateScene
    0x000000014143AFAD (Unity) PlayerLoopController::EnterPlayMode
    0x00000001414475C8 (Unity) PlayerLoopController::SetIsPlaying
    0x000000014144AB7D (Unity) Application::TickTimer
    0x00000001415E99E5 (Unity) MainMessageLoop
    0x00000001415EBDCC (Unity) WinMain
    0x000000014242DACA (Unity) __scrt_common_main_seh
    0x0000000076A559CD (kernel32) BaseThreadInitThunk
    0x000000007716A561 (ntdll) RtlUserThreadStart
     
  2. guzz

    guzz

    Joined:
    Dec 16, 2012
    Posts:
    5
    I found a way to fixed the crash: Add a animator component to the object and set a empty controller and avatar,then disable this component(don't delete this component). it will not crash again. I hope unity will fix this bug
     
  3. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675