Unity的mecanim的bug之Invalid Layer Index

1.会疯狂的报一堆错

   

Invalid Layer Index

解决方法1: build的时候把animator窗口关掉,奇葩,官方给的一种做法

            2:改回老的动画系统

            3:if(animator.layerCount == 0)
        {
            Debug.Log("fix controller error");
            string controllerName = animator.runtimeAnimatorController.name;
            animator.runtimeAnimatorController = (RuntimeAnimatorController)ResManager.getInst().getControllerRes(controllerName);
        }

原文地址:https://www.cnblogs.com/zhousilai/p/4353127.html