why when i try to set animation culling type, the game crash?

  animation, c++, crash, unity3d

why when i try to set animation culling type, the game crash?
I want to know why hanpped.
who can help me to fixed it?

the crash stack:

1 #00 pc 0010358c libunity.so Object::AddEvent(void (*)(void*, void*, int), void*) [armeabi-v7a]
2 #01 pc 007715b0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
3 #02 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
4 #03 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
5 #04 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
6 #05 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
7 #06 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
8 #07 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
9 #08 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
10 #09 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
11 #10 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
12 #11 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
13 #12 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
14 #13 pc 007715d0 libunity.so Animation::RecomputeContainedRenderersRecurse(Transform&) [armeabi-v7a]
15 #14 pc 00771400 libunity.so Animation::SetCullingType(Animation::CullingType) [armeabi-v7a]
16 #15 pc 00fd57ac libil2cpp.so CustomActor_onModelLoaded_m2523465691 (D:xxxxxAndroid_Currentcodeclient_codeTempStagingAreaIl2Cppil2cppOutput/Bulk_Assembly-CSharp_1.cpp:8061 [Inline: VirtActionInvoker1<int>::Invoke(unsigned int, void*, int)]) [armeabi-v7a]

the code sample:

 public abstract class CustomActor{
    protected virtual void onModelLoaded(GameObject new_model, int modelId) {
    this.destroyModel();

    this.model = new_model;
    float nModelScale = this.GetModelScale();
    this.model.transform.localScale = Vector3.one * nModelScale;

    this.m_ActorAnimation = new_model.GetComponent<Animation>();
    if (this.m_ActorAnimation) {
        // accoding to crasg stack infomation. the code try to set animation's cullingType to AnimationCullingType.BasedOnRenderers. the game crash!
        // actually, this crash is not happend a hundred percent.
        this.m_ActorAnimation.cullingType = AnimationCullingType.BasedOnRenderers;
    }

    if (this.IsVisible()) {
        if (this.m_ActorAnimation != null) {
            this.m_ActorAnimation.enabled = true;
        }

        SetEnableAnimation(this.m_MountAnimation, true);
    } else {
        if (this.m_ActorAnimation != null) {
            this.m_ActorAnimation.enabled = false;
        }

        SetEnableAnimation(this.m_MountAnimation, false);
    }

    CreateBoxColldier();

    this.updateHeadInfo();       
    this.RefreshAction();

    this.setMaterial(new_model);
    this.ApplyQuality(globalId, new_model);
  
    //ActorMgr.FireActorEvent(this, (byte)ActorEvent.ModelLoaded);
}

}

accoding to crasg stack infomation. the code try to set animation’s cullingType to AnimationCullingType.BasedOnRenderers. the game will be crash!
actually, this crash is not happend a hundred percent.

this.m_ActorAnimation.cullingType = AnimationCullingType.BasedOnRenderers;

very grateful to you for your help!!

Source: Windows Questions C++

LEAVE A COMMENT