Using python in unity

Hi, folks,I'm coding in C# in Unity 3D. However Python is my favorite language. And I understand that Python has been dropped by Unity team. If I make a tool to translate Python right into C#, would certainly supports:

Write all scripts in Unity in Python 3

Translate into C# automatically

Has a line to line mapping in between the scripts. So straightforward to debug

Would any type of one be interested in:

Testing this tool

Using it in your coding

Willing to purchase it, if usable.

You watching: Using python in unity

The tool I'll usage to do this will certainly be ANTLR.

Cheers.

Alex Wen


*

Unity has actually never before had Python support. What you're proposing doesn't make a lot sense to me.

You'd shed the assistance for interoperability through the big unity ecosystem of scripts and also add-ons. You're also going to lose a lot of performance and form security even if it's just transpiling it. You also can't sensibly provide a 1:1 line mapping between the languperiods bereason there are constructs in both langueras that don't map to each various other.

I guess my question is, what worth does this provide? C# is not hard to learn, and what you're proposing is no tiny job, so people would be dependent on you keeping it?


Thanks for your reply.

The python code will be translated right into C# script. All API and also objects and also libraries and also add-ons are still the exact same. Just the Syntax and also grammars are analyzed.

It's not a 1:1 line mapping. It's 1:n mapping from python to c#.

The value is I don't need to switch between the grammar and syntaxation. Since I usually usage Python.

See more: David Spade Book Review : 'Almost Interesting' By David Spade

ANTLR will define the rules of mapping python to C#. It will be open sourced so any kind of one have the right to keep it.

It's doable.


Well. That's debatable. It's a huge advantage for world who like Python.

The question is actually more a instance of "carry out the benefits outweigh the costs?"


Honestly, I don't think it would be worth it. I'm not saying it's difficult, yet it would certainly be a lot of work, administer incredibly bit benefits and the majority of noticeable drawbacks.


While it would certainly work-related for standard code, It'll be exceptionally messy for C#'s advanced functions.

The actual solution is just to learn C#, making tools that cater to refusal to learn is a big no-no. The perboy would certainly learn nothing, have no new transferable skills and wouldn't be able to execute anything external of what the regime supplies.


There's a bunch of currently existing jobs that enable use of Python inside Unity: https://github.com/search?q=unity+python

One I uncovered newly appeared fairly advanced yet I don't have actually time to hunt through at the minute.

However your source-translation-based strategy is definitely novel. I'm not sure if you're underestimating the obstacle yet. The core semantics of each language differs on a fundamental level.


One of the gold rules of programming (and IT in general for that matter) is:

You have to always use the aboriginal language of a tool

Any layer you add on height of a compiler just provides debugging far more tough. (is the error mine, or in the layer?)

This "rule" is just one of the factor programmers need to master various langueras also though one might be a favorite.