我特别从可从Unity资源商店下载的IntegrationTest类中获取此错误。Path.GetFileNameWithoutExtension在Unity 5中抛出错误
说的投掷错误的具体线路是在这里:
var fileName = Path.GetFileNameWithoutExtension(sceneName);
但你可以在上下文中看到它在这里。
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class DynamicTestAttribute : Attribute
{
private readonly string m_SceneName;
public DynamicTestAttribute(string sceneName)
{
if (sceneName.EndsWith(".unity"))
sceneName = sceneName.Substring(0, sceneName.Length - ".unity".Length);
m_SceneName = sceneName;
}
public bool IncludeOnScene(string sceneName)
{
var fileName = Path.GetFileNameWithoutExtension(sceneName);
return fileName == m_SceneName;
}
}
的统一编译器说:
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTest.cs(154,33): error CS0117: `Path' does not contain a definition for `GetFileNameWithoutExtension'
按照统一的文档,这是正确使用。也许有一个我错过的Unity 5的新文档链接。
好主意,这是淘气的iTween。请注意,您可以使用“使用Path = System.IO.Path”行来解决错误。在源文件的顶部。 (在这种情况下,我意识到这不是你的代码,但是如果你想在本地修复它,或者其他人都有问题)。 – yoyo 2015-03-31 04:51:25
哇!真棒洞察力的技巧谢谢你! – 2015-04-01 08:35:40
@ yoyo你已经完全解决了我的问题与这个答案。 – 2015-04-03 07:37:28