cocos creator 资源加载函数 resources.load 注意该函数为异步

            const  animationComponent = i.addComponent(Animation);
            if(animationComponent){
                const component = animationComponent.getComponent(Animation);
                if(component){
                    resources.load("Animation/toRight", AnimationClip, (err, clip) => {
                        component.addClip(clip, "toRight");
                        component.play("toRight");

                    });

                }

            }

注意调用

文章后续修改

posted @ 2023-07-24 20:03  赋流  阅读(242)  评论(0编辑  收藏  举报