- Home /
Is it possible to use the Open Babel Python module in Unity?
I am designing a game in which I would like to simulate chemical reactions using the SMILES notation interpreter Open Babel, which comes as a Python module. I have heard of people getting various versions of Python to work for scripting in Unity, but I am wondering if anyone thinks it would be possible to use a module like Open Babel in Unity scripts. The Open Babel Python module is described in detail here.
If anyone has an idea as to how this could work or has heard of anyone doing anything similar, please let me know!
Just a quick note, you should be warned that python is not fast. The only way to run python in .NET (AFAI$$anonymous$$) is using Python for .NET, which is a reimplementation of CPython (The standard python interpreter) for .NET. The CPython interpreter has a significant overhead and may be deadly for performance critical applications. If you need it to be fast, you should look for an equivalent library in a compiled .NET compatible language. If not, then you won't have to worry.
Answer by Adversary · Sep 14, 2014 at 10:14 PM
It's almost certainly possible, but it will require a significant amount of fiddling (which is why I haven't bothered just to prove the point). Note that the Python module for this thing still calls a library installed with the OpenBabel GUI, so it's not entirely self-contained (which adds more fiddling with the install).
To answer your question explicitly: if you can get that module to work with the natively installed version of CPython (2.7.x) on your system, then connecting that to Mono/Unity through Python for .NET will probably get you where you want.
That said, the OpenBabel site includes libraries for .NET directly and that might be a better route given Unity is built on Mono and .NET. If you're on Windows then this should definitely be considered and even if you're not then it should still be considered. Doing it in Python is going to involve spending a decent amount of time on the command line. There is no way around that (yet).
Open Babel is self contained. Only the optional GUI application (which is obviously not wanted) requires wxWidgets. Otherwise it doesn't have any requirements and is self contained.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135833im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to import the object from server to unity 2 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Material doesn't have a color property '_Color' 4 Answers
Setting Scroll View Width GUILayout 1 Answer