Using C # dynamic typing in Unity 5.3.1f

I wrote code for my game, which should run the function of my Python code. I am using Ironpython for my project. However, when I try to use C # dynamic typing to call a function in the code below, it compiles, but I get the following error from Internals:

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

I think mono does not support this. Could you give me a solution to help me?

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)
    {}
}
+4
source share
1 answer

Unity uses the .NET Mono 2.0 version, which is similar to .NET 3.5. dynamicwas introduced in .NET 4.0 , so Unity will probably not compile.

Mono 2.0 sub Mono 2.0, , , dynamic. , .

enter image description here

+2

All Articles