程序猿的独白 2021-03-22 16:40 采纳率: 0%
浏览 218
已结题

unity 设置Animation的culling type 导致游戏崩溃

在游戏中,尝试设置Animation.cullingType = AnimationCullingType.BasedOnRenderers;导致崩溃。

我想知道为什么会这样,还有该从哪里着手去解决它。

--------------------------------------------------------------------------

下面是代码详情。

**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:\xxxxx\Android_Current\code\client_code\Temp\StagingArea\Il2Cpp\il2cppOutput/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) {
    
        	/************ crash ****************/
            // 在这里尝试设置 animation 的 cullingType 为 AnimationCullingType.BasedOnRenderers. 游戏就崩溃了。
            // 
            // 事实上,这个崩溃并不是百分百复现的,在bugly上的崩溃率只有2%左右。
            // 开发基于Unity5.5.5p1, 崩溃发生在安卓各个版本合机型的机器上。(IOS没上)
            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);
        }
    }

            /************ crash ****************/

           // 在代码中
            // 在这里尝试设置 animation 的 cullingType 为 AnimationCullingType.BasedOnRenderers. 游戏就崩溃了。
            // 事实上,这个崩溃并不是百分百复现的,在bugly上的崩溃率只有2%左右。
            // 开发基于Unity5.5.5p1, 崩溃发生在安卓各个版本合机型的机器上。(IOS没上)
            this.m_ActorAnimation.cullingType = AnimationCullingType.BasedOnRenderers;

 

 

  • 写回答

1条回答 默认 最新

  • 歇歇 2021-03-23 10:26
    关注

    选中Animator试试

    替代文字

    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)