我必须延迟这个过程的发生,我在 Update 函数中调用它。我也尝试过 CoUpdate 解决方法。这是我的代码:-
function Start()
{
StartCoroutine("CoStart");
}
function CoStart() : IEnumerator
{
while(true)
{
yield CoUpdate();
}
}
function CoUpdate()
{
//I have placed the code of the Update().
//And called the wait function wherever needed.
}
function wait()
{
checkOnce=1; //Whenever the character is moved.
yield WaitForSeconds(2); //Delay of 2 seconds.
}
当第三人称控制器(另一个对象)移出边界时,我必须移动一个对象。我在我的代码中包含了“yield”。但是,发生的问题是:当我在 Update() 中给出代码时正在移动的对象正在移动,但没有停止。它正在上下移动。我不知道发生了什么!有人可以帮忙吗?请,谢谢。