首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Unity3D协同编译错误

Unity3D协同编译错误
EN

Stack Overflow用户
提问于 2015-06-28 13:25:24
回答 2查看 1.2K关注 0票数 2

我是一个完全统一的初学者,我正在尝试用协同器来播放动画,但是得到以下错误:

1.错误CS1502: CS1502#1‘的最佳重载方法匹配不能转换UnityEngine.MonoBehaviour.StartCoroutine(System.Collections.IEnumerator)' has some invalid arguments 2.error CS1503: Argument

守则:

代码语言:javascript
复制
     using UnityEngine;
using System.Collections;

public class Trap : MonoBehaviour {

    //public float delayTime;


    // Use this for initialization
    void Start () {
        StartCoroutine (Go ());
    }

    // Update is called once per frame
    void Update () {

    }

    IEnumerable Go(){
        while (true) {
            animation.Play();
            yield return new WaitForSeconds(3f);
        }
    }

}
EN

回答 2

Stack Overflow用户

发布于 2015-06-28 13:57:19

变化

代码语言:javascript
复制
IEnumerable Go(){
    while (true) {
        animation.Play();
        yield return new WaitForSeconds(3f);
    }
}

为了一个IEnumerator..。

代码语言:javascript
复制
IEnumerator Go(){
    while (true) {
        animation.Play();
        yield return new WaitForSeconds(3f);
    }
}
票数 6
EN

Stack Overflow用户

发布于 2015-06-28 17:35:40

Coroutine的返回类型将是IEnumerator。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31100333

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档