Running Unity on Linux through Wine

Notice: The Unity editor is now available on Linux and can be downloaded through the Unity Hub

For information on running the Unity Web Player in Linux native browsers see the Running Unity Web Player on Linux using Pipelight page.

Officially Unity Technologies only support creating executable standalone games/3D applications which can then be run on Linux, specifically Ubuntu 10.04 or newer(Source). 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 video/graphics cards.

Prerequisites

 * An operating system/distribution that is able to run Wine, also see 'Tested successfully on distributions' section within this wiki page.


 * Newest stable drivers for your graphics card

If you plan to use the lengthy PlayOnLinux method of installing Unity you will also need:


 * PlayOnLinux - Software that is able to manage multiple versions of Wine.


 * Most recent Wine on PlayOnLinux - This is installed from within PlayOnLinux, a native installation of Wine is not required.


 * Official Windows installer file for Unity (Versions of 4.X.X and 5.X.X are the ones tested )

Tested successfully on following distributions
Users from the community have reported of getting Unity working on the following operating systems/distributions:


 * openSUSE 13.1 (reported to be most stable at running the Unity editor)


 * Ubuntu 12.10/13.10/14.04/15.04, Lubuntu 13.10/14.04/14.10/15.04 and Xubuntu 14.04 (for now the only distros that receive Unity Technologies support for Linux Standalone Unity applications and Valve Software's support for running Steam)


 * Fedora 19/20


 * RedHat 7 Beta


 * Debian Jessie


 * Linux Mint Debian Edition


 * Arch Linux


 * Manjaro

Installing Unity using the terminal with a winetricks script (Experimental, yet quicker)
User "Doctor Jellyface" saw the use of PlayOnLinux as unnecessary way to install Unity, even with the better graphics interface that PlayOnLinux offers. So he created a winetricks script that installs Unity and all the necessary libraries to make Unity work on a native Wine.

1. Install Wine, by following instructions from its official website for your Linux distribution.

2. Download the newest Unity installation script from github.

3. If you have a 64 bit operating system, then it best to set the default Arch to 32 bit for new Wineprefixes as winetricks does not have much support for 64bit wineprefixes. So before proceeding with the next step, set the environment variable through your terminal:

$ export WINEARCH=win32

(Example given for Ubuntu Linux, this environment variable will only last in that terminal session, which is enough while installing Unity)

4. Open up a terminal, move to the location of the downloaded ".verb" script and run the script using winetricks(installed by default with some "Wine" distro packages, if not see winetricks install page):

$ winetricks -q "./unity3d.verb"

If this does not fully complete, remove the "-q" argument to debug.

5. A 'Unity' shortcut should be on your desktop. Wine should be launching it. If it does not then the Unity prefix should be located under "~/.local/share/wineprefixes/unity3d".

Skip PlayOnLinux section>>>

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

Most of these numbered steps come from a user called 'Tomza', you can read his blog post on this issue for reference.

Install PlayOnLinux
Follow the installation instructions provided by PlayOnLinux for your distribution.

Download the Windows Unity Installer
Download the Windows installer of Unity from the official site. Do not run/execute the file.

PlayOnLinux first launch
When you run PlayOnLinux for the first time, you will see the PlayOnLinux Wizard:

  PlayOnLinux cannot find wine (from Wine)
 * Possible first warning:

You should install it to use PlayOnLinux  The reason for this warning is that PlayOnLinux wanted add the natively installed Wine as one of available Wine versions, which sometimes might not be present. Click OK. 

  PlayOnLinux cannot find 7z (from P7ZIP full)
 * Possible second warning

You should install it to use PlayOnLinux  7zip is an archive creator, extractor. We don't need this now. Click OK. 

  Windows Fonts useful for all programs you will run on PlayOnLinux
 * Possible third warning

Install Windows fonts </li> Linux does not come with Windows fonts. This is solved by the script, no need to worry about it.</li> Click Next.</li> </ol>

When all is over, you should see Enjoy using PlayOnLinux.

Managing wine versions
Warning: Remember that the newest Wine can be unstable (Wine 1.6.2 is stable), but, at the same time, some bugs can be fixed in the recent version, and that’s why it can be the best way to go for you; fortunately, you can choose the Wine version in PlayOnLinux you like even after installing an application; the recent version is recommended for running Unity3D because of 3D driver improvements.
 * 1) From PlayOnLinux's window header choose "Tools" -> "Manage Wine Versions".
 * 2) Choose a recent Wine version, 32 bit if you're on a 32 bit system or you're going to install the 32 bit editor, 64 bit otherwise.
 * 1) Click the arrow to install your version of Wine.

Getting the script
A PlayOnLinux script has been created by the Unity Community to easily install Unity. Save the following script to your disk in plain text. You can call it as you want, but the .pol extension should be kept so that PlayOnLinux can recognize it as its script.

You can find the script on GitHub.


 * Warning for Ubuntu users
 * This script will fail with an due to system wide parameter called 'ptrace_scope'. See Regarding ptrace_scope fatal error for a fix.

Adjusting the wine version
Depending on your installed wine versions you may want to change the Wine version before running the script.

Just change this line accordingly: POL_Wine_PrefixCreate “Your.Version.Number”

Installing Unity
 From PlayOnLinux, go to Tools→Run a local script.</li> Choose the script and click Next.</li> You will see the warning that the signature of the script isn’t valid. It is an unofficial script, so you can safely ignore it. Click Next.</li> You will be able to review the script. If it's fine, check I agree and click Next.</li> Then you will see the installation wizard, click Next, the following should appear: The script is running

a virtual drive is being created first – it will be the place where your whole installation will be placed.

a/ The environment for the virtual disk When you run PlayOnLinux for the first time, some extra software may be installed.

PlayOnLinux should now be installing the components it needs for Unity3D and MonoDevelop to work on Wine. The list of their names is included in the script you are using. They are really important, so wait patiently. </li> When the script installs up the components, find the Unity setup executable on your disk through the PlayOnLinux window.</li> Install Unity3D just like in Windows. Follow the instructions during the installation. You may want to install the AngryBots project to test your installation of Unity. If errors appear, don't worry about them too much – they probably aren't show-stoppers.</li> Click Finish in the Unity installation wizard and the PlayOnLinux installation wizard. You will see the Unity icon in the main PlayOnLinux window – you can start Unity from here if you want. You can see two Unity icons on your desktop. Delete the one called simply "Unity", which is created by the Unity installer and might not work. "Unity3D" is the one created by the script. If you haven't launched Unity yet, do it.</li> Do everything Unity wants you to do (Activate your Unity License – free or pro, log in to your Unity account). Click Start using Unity to start using Unity, obviously.</li> <li>When you see the Project Wizard dialog, you may want to open the AngryBots project (if you chose to install it) for testing purposes. It is located under "C:\users\Public\Documents\Unity Project\". Disk Z: is your Linux disk. <li>If everything is working fine, celebrate.</li> </ol>

Editing image assets with a native Linux Image Manipulation Program
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: if [ -z "$1" ] then echo "No file specified" exit 1 fi
 * 1) !/bin/sh

gimp "`wine winepath -u "$1"`"
 * 1) Change 'gimp' to the command name of your desired image manipulation program.
 * 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.

Sublime Text
if [ -z "$1" ] then echo "No file specified" exit 1 fi
 * 1) !/bin/sh

/opt/sublime_text/sublime_text "`wine winepath -u "$1"`:$2:$3"
 * 1) Change '/opt/sublime_text/sublime_text' to the path of your executable for desired IDE.
 * 1) 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

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

/usr/bin/kate "`winepath -u "$1"`" -l "$2"
 * 1) We assume that the kate executable is lies in '/usr/bin/'. Change the path if necessary.
 * 1) Note that the 'wine winepath', which translates Windows path name to Unix, is the natively installed 'wine'.

echo "Opening '$1' on line '$2' with Kate" 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)' (without the '' ).

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.

Installing a Compatible Version (Fedora)
At the time of this writing, Unity uses Monodevelop 4.0.1 internally. However, Fedora 22- uses 2.8.8.4 and the Official monodevelop packages are version 5.9. The latest stable version should work fine. The Unity monodevelop Add-ins do install but may be missing some functionality (Ctrl+' at least functions correctly.) You can install the latest Monodevelop from the project's website: http://www.mono-project.com/docs/getting-started/install/linux/#centos-fedora-and-derivatives

Installing Unity Add-ins (Ctrl+' Support)

 * 1) Open the native Monodevelop through Unity or directly.
 * 2) Menu Bar: Tools->Add-in Manager
 * 3) Click the Gallery Tab and search for "Unity"
 * 4) Install "Utilities for use with Unity" and other Add-ins you may find useful.

If you installed the latest Monodevelop you may see multiple warning messages, If you are just interested in the Ctrl+' shortcut, then these warning messages don't matter. Good luck finding out what doesn't work.

Example Warning Message The add-in 'XXXX' could not be updated because some of its dependencies are missing or not compatible: required: MonoDevelop.Core,4.2.3, found: MonoDevelop.Core,5.9

Opening from Unity
User Radivarig created a script to use a native (Linux) version of MonoDevelop as the editor. It handles pretty much everything, and the functionality shouldn't be different than on Windows.

You can find the script on GitHub.

Usage:

1. Download the script and give it execution rights like so (assuming you installed Unity into the default wine prefix): wget https://raw.githubusercontent.com/Unity3D-Wine-Support/Unity3D-on-Wine/master/text-editors-MonoDevelop/unity3d_native_monodevelop.sh mkdir ~/.wine/drive_c/Program\ Files/Editors mv ./unity3d_native_monodevelop.sh /.wine/drive_c/Program\ Files/Editors chmod +x ~/.wine/drive_c/Program\ Files/Editors/unity3d_native_monodevelop.sh 2. Set the script as the editor in Unity: navigate to Edit->Preferences->External Tools and set the script as the editor, with arguments "$(File)" $(Line)

Custom editor
You can use this script as a base to make your own editor launcher.

Troubleshooting
First see if your issue hasn't already been resolved by someone in GitHub Closed/Resolved Issues.

If it is not, raise your issue there in GitHub Open Issues.

The following may not be up to date.

Unity Asset store does not work in Unity 4 and down (has a workaround)
The Asset store window/tab shows up gray, but some elements on the window are picked up judging from that the mouse cursor changes. Some believe it is a WebKit issue.

However, user dialytica found a neat workaround: you can search on the Asset Store, login, download and import assets simply by searching in the Project View, ticking "Asset Store", and clicking on the search results.

WineHQ bug report: http://bugs.winehq.org/show_bug.cgi?id=34039

Issue on GitHub: https://github.com/Unity3D-Wine-Support/Unity3D-on-Wine/issues/5

Project Creation: "Specified path is not valid..." error message
While it might seem strange, this is an Internet Explorer issue. It is fixed by installing Internet Explorer 8. Preferably using winetricks "ie8" or in PlayOnLinux case, "Internet Explorer 8" component.

"-force-opengl" option crashing Unity (Experimental fix)
By default Unity Editor for Windows uses Direct3D to render graphics and Wine redirects Direct3D calls to OpenGL calls, which has compatibility and performance issues. Unity Technologies have included "-force-opengl" argument to force Unity to use OpenGL.

The reason for the crash is supposedly "because Unity 3/4 does something with OpenGL contexts that is acceptable for WGL, but not for the Linux equivalent layer called GLX.". But there exists a patch for Wine that allows Unity to run in OpenGL mode, but, to add the patch, Wine has to be compiled with it included.

Performance gains are reported to be between 10% to 400%.

How to fix: If you have a 32bit Linux distribution, follow instructions in this script(note that it is for Ubuntu), you may skip the following numbered steps.

1. If you have a 64bit Linux distribution, then it should be noted that winetricks does not have full support for 64bit Wine as of yet. Follow the instructions on how to compile a 32bit Wine on a 64bit OS here, only up to the point of getting the source code.

2. Before compiling Wine, add the patch to the source code folder through the terminal:
 * > wget https://raw.githubusercontent.com/Unity3D-Wine-Support/Unity3D-on-Wine/master/Compile-Wine/WGL-ShareList-Hack.patch
 * > cat ./WGL-ShareList-Hack.patch | patch -p1

3. Compile Wine.

4. Run Unity with the new Wine using something like
 * > env WINEPREFIX="~/.local/share/wineprefixes/unity3d" ~/wine32/wine ~/.local/share/wineprefixes/unity3d/drive_c/Program\ Files/Unity/Editor/Unity.exe -force-opengl

Results: Screenshot of a empty scene with a cube

Ubuntu: Windows cannot be fully maximized
This might actually be an issue for all Wine applications contained within a window. See the following answered question for the way in fixing this issue: http://askubuntu.com/questions/267843/how-can-i-fully-maximize-wine-applications

Unity dashboard is all grayed out
This bug may appear when the Linux system's timezone is set as a "named" timezone (like "America/Sao Paulo"). Switch the timezone to another, which is not named and has only the GMT code, like 'GMT+3'.

To do this, open up a terminal.

For Ubuntu/Debian type: sudo dpkg-reconfigure tzdata

In the menu that opens up, go down and choose "etc" and set right timezone code according to your location in GMT.

NVIDIA: Unity does not refresh windows often enough
When selecting a game object, the inspector might not refresh at the right time, showing the previous game object. Same thing may happen when writing text in a text input and seeing the previous state.

Steps to reproduce:
 * 1) Click on a GameObject.
 * 2) In inspector click on show/hide Transform tag multiple times until the line is turns up gray as if it is opened, but doesn't seem like it.
 * 3) When this happens, click the inspector tab(to refresh the window) and then on a parameter. When writing you should see only the previous state of the text.

Reported on:
 * Ubuntu 13.10/14.04
 * Wine 1.7.15/.16/.17/.18
 * Graphics card: NVIDIA Geforce 9600GT/GT320M
 * NVIDIA driver (proprietary) 319/331.38
 * NVIDIA driver (open-source) 331.67/334.21/337.12/337.25 (These are made available when adding ppa:xorg-edgers/ppa repository)

Most likely culprit:

NVIDIA graphics drivers, although in -force-opengl mode other vendor graphics cards also experience this bug.

How to solve:


 * Enable "Strict Draw Ordering". You have to add a key to the registry, see [UsefulRegistryKeys]. For PlayOnLinux installation of Unity, there is an option in its configuration. This might impact performance.

Or


 * Use the Nouveau graphics driver, which does not have up to date 3D acceleration.

Built-in MonoDevelop doesn't launch
This sometimes happens because Wine launches MonoDevelop in a new wineprefix. Luckily, Radivarig created a script to fix this. Simply download the script, give it execution rights and set it as the editor in Unity.

You can find the script on Github.

Github repository for Wine related scripts and issues
https://github.com/Unity3D-Wine-Support/Unity3D-on-Wine

If you have a Github account, it is recommended to set this repository as "Watch" in order to be notified of enhancements and bugfixes.

Github Unity3D-on-Wine Issues page
First see if your issue hasn't already been resolved by someone in Closed/Resolved Issues.

If it is not, raise your issue there in Open Issues.

Unity Forum Thread
Visit and contribute in the forum thread created on the Official Unity Forum.

Wine Application Database (AppDB)
Unity Editor page - https://appdb.winehq.org/objectManager.php?sClass=application&iId=11075

If you have used the Unity Editor for notable amount of time, then it would be helpful to vote for the closest compatible test done within AppDB or make your own test.

IRC channels
Unofficial IRC channel on freenode is #unity3d-wine, since it is unofficial few to none users may be on it, don't leave it because of that.

You may also try raising your issue on official Wine related IRC channels #playonlinux or #winehq.