我专门从IntegrationTest类中获取此错误,可以通过Unity资源商店免费下载。
抛出错误的具体行在这里:
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;
}
}
Unity编译器说:
Assets/UnityTestTools/IntegrationTestsFramework/TestRunner/IntegrationTest.cs(154,33): error CS0117: `Path' does not contain a definition for `GetFileNameWithoutExtension'
根据Unity文档,这是正确的用法。也许我错过了Unity 5的新文档链接。
答案 0 :(得分:1)
请注意,您可以使用路径"使用Path = System.IO.Path;"来解决错误。在源文件的顶部。 (我知道在这种情况下它不是你的代码,但如果你想在本地修复它,或者其他任何人都有问题。)
感谢@yoyo提供答案!
答案 1 :(得分:0)
好的,问题是我刚刚从资源商店导入了iTween示例,并且它有一个名为Path的类,因此两个类定义--Unity的默认值和iTweens示例中的定义相互冲突并且编译器决定了iTween之一是''一,它没有包含上面提到的方法。
也许我应该向Pixel Placement小伙伴发送一个关于它的说明。