• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jarl-ostensen · Dec 10, 2013 at 03:53 PM · macosxpython

Does Unity include its own Python interpreter and does it use it for post process builds on Mac?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jarl-ostensen · Dec 10, 2013 at 03:54 PM 0
Share

Specifically I am seeing a discrepancy between running a postbuild script (Prime[31]'s) using the system default python interpreter on the command line and it being invoked by Unity itself. The version on the system is 2.7 and the (pyc) script doesn't work with it. When running the build through Unity (which invokes the build script) it works so I assume Unity does ship with it's own 2.6 version of the Python interpreter...?

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by jarl-ostensen · Dec 12, 2013 at 02:16 PM

Apparently not; it just invokes python2.6 directly which exists side-by-side with the latest v3 on OS X,

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Adversary · Sep 14, 2014 at 08:36 PM

It depends on just how much Unity have modified MonoDevelop to make their editor(s). If they haven't done much to Python then there should be an ironpython/ directory in /Library/Frameworks/Mono.framework/Versions/Current/lib/ which it will use by default (via the /Library/Frameworks/Mono.framework/Versions/Current/bin/ipy* scripts). This can easily be overridden with an alternative installation of IronPython or even the Python for .NET code to integrate Mono with the native Python installation. Both IronPython and Python for .NET can play nicely with Python 2.7 (current releases of IronPython are re-implementations of Python 2.7).

Admittedly I've only been looking at this project for a day or two, but I've got Mono to play with IronPython 2.7.4 and 2.7.5-beta2. I've also got Python for .Net to see my install of CPython 2.7.8 (just the standard installer from python.org). Unfortunately neither Python for .Net nor IronPython have completed useful ports for any of the Python 3 releases. Also, PyPy have not yet completed their own .NET/Mono porting, but when that completes or reaches a usable state it's likely to make some things a little more interesting.

As for the specifics of what Unity have done, they appear to have the framework data stored inside the app instead of in the OS X /Library/Frameworks/ directory. So you'll need to either use the show contents option in Finder or just cd through the the app subdirectories in Terminal. If, like me, you just copied the whole Unity folder into /Applications then you're looking for something like this (note: version numbers are likely to change depending on the Unity release used):

/Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/Current/lib/

The directory structure is identical to a standard Mono installation, just kept inside the app directories. So the methods of installing, adding or updating Python to Mono will work here too. A quick update for what I've got in Mono to Unity results in this:

 bash$ pwd
 /Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/Current
 bash$ ./bin/mono lib/IronPython-2.7.4/ipy.exe
 IronPython 2.7.4 (2.7.0.40) on Mono 4.0.30319.1 (32-bit)
 Type "help", "copyright", "credits" or "license" for more information.
 >>> quit()
 bash$ ./bin/mono lib/IronPython-2.7.5b2/ipy.exe
 IronPython 2.7.5b2 (2.7.5.0) on Mono 4.0.30319.1 (32-bit)
 Type "help", "copyright", "credits" or "license" for more information.
 >>> quit()
 bash$ ./bin/mono lib/pythonnet/python.exe 
 Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35) 
 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> print sys.platform
 darwin
 >>> sys.exit()
 bash$ 

Looks fine. User friendly plug-in/add-on/extension support within the Mono/Unity GUI is up to the individual. Note that the Mono developers disabled the Python add-on for OS X so they may have broken something within their GUI in relation to Python. I'm not sure, I haven't tried getting around that yet.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Crash on Mac, when switching application 1 Answer

A node in a childnode? 1 Answer

Unity 3.5b6 building for OSX 10.5 0 Answers

How to install Unity 4 on OSX after installing 5 2 Answers

Unity UI Tearing on resolution change on OSX 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges