BCE0019:xxx不是'Object'的成员

时间:2016-03-31 05:23:43

标签: javascript unity3d

enter image description here

我键入了aniPlay=GetComponent("aniSprite"),但似乎无效,我该如何修改呢?

2 个答案:

答案 0 :(得分:0)

尝试:

privat var aniPlay : aniSprite;

function Start () {
    aniPlay = gameObject.GetComponent(aniPlay);
}

答案 1 :(得分:0)

aniPlay = gameObject.GetComponent(aniPlay);

这是GetComponent的正确形式,但要实现这一点,您需要确保以下事项:

  1. aniPlay是工人阶级的实际名称
  2. 指定的gameObject附加了该类的实例