近期热门
unity动画无法播放究竟是什么原因?

[U3D] unity动画无法播放究竟是什么原因?

[复制链接]
18016 6 0 0 12年前
有个问题一直很头疼。在3Dmax中调好了一辆车的模型动画,导入到unity中之后,编写脚本
using UnityEngine;
using System.Collections;

public class ggg : MonoBehaviour {
       
        public const string Lun="nn";
       
        private GameObject obj;
        // Use this for initialization
        void Start () {
                obj=GameObject.Find ("car");
                obj.animation.wrapMode=WrapMode.Loop;
        }
       
        // Update is called once per frame
        void Update () {
                if(Input.GetKeyDown (KeyCode.A)){
                        obj.animation.Play (Lun);
                }
        }
}
运行之后发现汽车没动,并且有错误
MissingComponentException: There is no 'Animation' attached to the "car" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "car". Or your script needs to check if the component is attached before using it.
。。请教大家,这究竟该怎么办?

0
点赞
0
打赏
0
添加到收藏夹

0

点击复制链接

使用微信扫码分享
一次扣10个券
全部评论6
您需要登录后才可以回帖 登录

检查下模型文件的动画类型
8年前  ·  7楼
回复

使用道具 举报

CGJOY网友 
你没有这段动画  你的代码还有俩处错误

10年前  ·  6楼
回复

使用道具

它说你的CAR没有动画,仔细检查下你的动画有没有导进来
12年前  ·  5楼
回复

使用道具 举报

CGJOY网友 

我也遇到那个问题呢 怎么解决呢


12年前  ·  4楼
回复

使用道具

介是神马?!!
12年前  ·  3楼
回复

使用道具 举报

鼎力支持!!
12年前  ·  2楼
回复

使用道具 举报

您当前使用的浏览器IE内核版本过低会导致网站显示错误

请使用高速内核浏览器或其他浏览器