Running Unity on Linux through Wine

From Unify Community Wiki
Revision as of 11:19, 13 April 2014 by Jānis Lukss (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Officially Unity Technologies only support creating executable standalone games/3D applications which can then be run on Linux. This is done by using the Unity Editor in Microsoft Windows and OS X operating systems. Unity Technologies do not provide a Linux version of the Unity Editor. Unity Editor can still be launched on Linux by using the Windows version of the editor with mimicked Windows libraries provided by the Wine software. Stability of the editor depends on particular Linux distributions and the graphics cards.

Contents

Prerequisites

  • An operating system/distribution that is able to run Wine, also see 'Tested successfully on distributions' section.
  • PlayOnLinux - Software that is able to manages different wine versions.
  • Most recent Wine on PlayOnLinux - This is installed from within PlayOnLinux, a native wine installation is not required.
  • Official Windows installer file for Unity (Versions of 4.X.X are the ones tested)
  • Newest stable drivers for your graphics card

Tested successfully on distributions

Users from the community have reported getting Unity working on the following operation systems/distributions:

  • openSUSE 13.1 (reported to be most stable)
  • Debian Jessie

Installing PlayOnLinux

PlayOnLinux is a program that is able to manages different wine versions for cases when a Windows application works on wine version but not another and so allows easy switching without also breaking another Windows application.

Follow installation instructions provided by PlayOnLinux for your operating system/distribution.

Download Unity Installer (Windows)

Download the Windows installer of Unity from the Official Site. Do not try to run/execute the file.

Installing Wine and Unity using PlayOnLinux

TODO: Uff so many scripts to choose from...

Editing image assets with a native Linux Image Manipulation Program by default

By default Unity will open image files with Internet Explorer. While it is possible to set a Linux executable to be run by Unity in its preferences, the file path that Unity will provide is a Windows styled one '/PlayOnLinux Drive/C:\UnityProject\Assets' which the image manipulation program will probably not recognize.

Wine has a tool that can translate Windows styled paths to Unix styled paths. A shell script can be used as the target to translate the path before giving it to the desired program, in this case GIMP:

#!/bin/sh
if [ -z "$1" ]
then
	echo "No file specified"
	exit 1
fi

# Change 'gimp' to the command name of your desired image manipulation program.
gimp "`wine winepath -u "$1"`"
# Note that the 'wine winepath', which translates Windows path name to Unix, is the natively installed 'wine'.

echo "Opening $1 with GIMP"
exit 0

Save it to a file that Unity can see and set it as an executable(like 'chmod 755' through the terminal), then set the shell script as the Image Manipulation program in Unity Preferences.

NOTE: A native 'Wine' version needs to be installed for this script to work. TODO: Make the script use PlayOnLinux's installed Wine to translate file paths.

Editing scripts with a native Linux script editor

Depending if you installed Unity with MonoDevelop, then Unity will open script files with either Notepad or MonoDevelop by default. Same when double-clicking on script errors and warnings. While it is possible to set a Linux executable to be run by Unity in its preferences, the file path that Unity will provide is a Windows styled one '/PlayOnLinux Drive/C:\UnityProject\Assets' which the editor will probably not recognize.

Wine has a tool that can translate Windows styled paths to Unix styled paths. A shell script can be used as the target to translate the path before giving it to the desired program and also providing the line of code to jump to, in this case Sublime Text:

#!/bin/sh
if [ -z "$1" ]
then
	echo "No file specified"
	exit 1
fi

# Change '/opt/sublime_text/sublime_text' to the path of your executable for desired IDE.
/opt/sublime_text/sublime_text "`wine winepath -u "$1"`:$2:$3"
# Note that the 'wine winepath', which translates Windows path name to Unix, is the natively installed 'wine'.

echo "Opening '$1' on line '$2' column '$3' with Sublime Text"
exit 0

Save it to a file that Unity can see and set it as an executable(chmod 755), then set the shell script as the External Script Editor program in Unity Preferences with correct format in its arguments, for this shell script it's '"$(File)" $(Line)'.

NOTE: A native 'Wine' version needs to be installed for this script to work. TODO: Make the script use PlayOnLinux's installed Wine to translate file paths.

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox