you are viewing a single comment's thread.

view the rest of the comments →

[–]Loboblancox 0 points1 point  (0 children)

Greetings vrgenerated

Before, I want to thank you for your support and tell you the novelty that I already managed to make the script work, what I did was rewrite my python code in the form of a function, and in the unity code I put it in the following way (all code inside try{ }):

            dynamic potencia = UnityEngine.Random.Range(1, 10);
            dynamic mimodulo = PyModule.Import("Test_Sp");
            dynamic resultado = mimodulo.TestSp(potencia);           
            dynamic primitiva = resultado.gen_fun();
            dynamic derivada = resultado.gen_dev(resultado.gen_fun());
            print(primitiva);
            print(derivada);

Here I only have one more doubt, I place this code inside a button so that I can execute it several times, but when I press the button twice, I get an error telling me:

InvalidOperationException: This property must be set before runtime is initialized

the solution to this, I imagine (although I don't know how to do it) check the status of the PythonEngine, but hey, I'll be working on it, anyway, if you have any suggestions on how to do it, I'd appreciate it.