gpt4 book ai didi

c# - 在 Unity 5.3.1f 中使用 C# 动态类型

转载 作者:行者123 更新时间:2023-11-30 12:23:41 25 4
gpt4 key购买 nike

<分区>

我已经为我的游戏编写了代码,需要运行我的 python 代码的功能。我正在为我的项目使用 Ironpython。但是,当我尝试使用 C# 动态类型来调用下面代码中的函数时,它会编译,但我从 Internals 得到以下错误:

" Assets/Scripts/WordSearchAlgorithm.cs(37,29): error CS1502: The best overloaded method match for
System.Runtime.CompilerServices.CallSite,object>>.Create(System.Runtime.CompilerServices.CallSiteBinder)' has some invalid arguments " "
Assets/Scripts/WordSearchAlgorithm.cs(37,29): error CS1503: Argument
'#1' cannot convert 'object' expression to type
'System.Runtime.CompilerServices.CallSiteBinder' " "
Assets/Scripts/WordSearchAlgorithm.cs(37,61): error CS0234: The type
or namespace name 'RuntimeBinder' does not exist in the namespace
`Microsoft.CSharp'. Are you missing an assembly reference? "
Assets/Scripts/WordSearchAlgorithm.cs(37,61): error CS1502: The best
overloaded method match for 'System.Runtime.CompilerServices.CallSite>.Create(System.Runtime.CompilerServices.CallSiteBinder)' has some invalid arguments

我认为单声道不支持这个。你能给我一个解决方案来帮助我吗?

static public void StartSearchAlgorithm()
{
List < string > myList = new List < string > ()
{
"fxie",
"amlo",
"ewbx",
"astu"
};
var ironPythonRuntime = Python.CreateRuntime();
try
{
//Load the Iron Python file/script into the memory
//Should be resolve at runtime
dynamic loadIPython = ironPythonRuntime.UseFile("C:/py.py");
//Invoke the method and print the result
loadIPython.BoggleWords(myList, loadIPython.MakeTrie("C:/words.txt")); // here is my problem to calling function from python that unity logError
// Debug.Log(string.Format("dd", loadIPython.BoggleWords(myList, loadIPython.MakeTrie("C:/words.txt"))));
}
catch (FileNotFoundException ex)
{}
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com