0

I have a bunch of Python code with a lot of dependencies (pytorch, opencv, etc.) that I want to use in a Unity application that can be deployed on both PCs and mobile devices. After a lot of research, I found that the most painless way seems to be compiling my code into a shared library for the Unity application to call. However, I don't know what is the best way to do it.

One way that I've been considering has been embedding Python into C++, and then compile it into a shared library. But according to what I've tried so far I still need to have the Python code around for the C++ library to call. That would be quite difficult considering the number of dependencies (the app is to be deployed onto mobile devices).

I wonder if there is a way to compile my Python code into a standalone shared library that can be called in a Unity application?

Ryan Aleksander
  • 423
  • 5
  • 18

1 Answers1

0

You can use IronPython it will execute scripts directly in C#, because ironPython is just like Cpython probably the one your using but written in C# not C

Get IronPython at www.ironpython.net Not an ad

Or see this

How do I run a Python script from C#?

12ksins
  • 307
  • 1
  • 12