我在运行这个协程时遇到了问题。它一直吐出一个错误,说它不能将 WaitUntil 转换为字符串,当我将 WaitUntil 添加到返回类型时,它又吐出另一个说它无法返回。我已经尝试研究了几个小时,但无济于事。这是代码的片段:
public string OpenSaveDialog(string Title, string OpenLocation, string[] AllowedExtentions)
{
OpenBtn.GetComponentInChildren<TMPro.TMP_Text>().text = "Save";
TitleText.text = Title;
AllowFileNameTyping = true;
MultiSelect = false;
LoadIntoExplorer(PathInput, AllowedExtentions);
return StartCoroutine(WaitForFinish()); // Error here: Cannot implicitly convert type 'UnityEngine.Coroutine' to 'string'
}
IEnumerator<string> WaitForFinish()
{
yield return new WaitUntil(() => Done == true); // Error here: Cannot implicitly convert type 'UnityEngine.WaitUntil' to 'string'
yield return FilePathsSelected[0];
}
Run Code Online (Sandbox Code Playgroud)