2016-03-01 61 views
4

我想通过使用统一测试工具包编写集成测试。为什么“yield yield new WaitForEndOfFrame()”永远不会以批处理方式返回?

测试在编辑器中运行时没有问题(在播放模式下)。

但是,当我尝试从命令行运行集成测试(以批处理模式)等待结束时帧协程永远不会返回。

这是一个已知问题还是我错过了什么?

我使用下面的命令来运行测试:

/Applications/Unity-5.3.1-f1/Unity.app/Contents/MacOS/Unity \ 
    -batchmode \ 
    -nographics \ 
    -logfile \ 
    -projectPath $(pwd) \ 
    -executeMethod UnityTest.Batch.RunIntegrationTests \ 
    -testscenes=TestScene \ 
    -resultsFileDirectory=$(pwd) 
+0

看起来像一个错误:https://issuetracker.unity3d.com/issues/yield-waitforendofframe-never-happens-in-batchmode这是一些代码(据说)修复了集成测试用法的问题:https:// bitbucket.org/Unity-Technologies/unitytesttools/pull-requests/33/workaround-for-issue-with/diff – smg

回答

-1

如果您使用C#,它不会工作。如果你使用JS,它会。对于C#,您需要使用Coroutine,IEnumerable。

与YieldForSeconds等的Yielding调用相同它们不支持C#的yielding原因Mono Unity3d只能在MainThread上运行,并且不能成功,因为您将获得App不响应。另一方面,当JS正在工作时,它并不完全停止呼叫,它正在停止它自己的脚本。这就是为什么为C#添加invoke方法以延迟。

+0

问题是问为什么'WaitForEndOfFrame'在批处理模式下无法按预期工作。这个答案根本不回答这个问题。 – zyzof

相关问题