Running Unity on Linux through Wine

For how to run the Unity Web Player on Linux 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.


 * 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 are the ones tested)


 * Newest stable drivers for your graphics card

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 and Lubuntu 13.10/14.04 (for now the only distros that receive Valve Software's support for running Steam)


 * Fedora 20


 * RedHat 7 Beta


 * Debian Jessie


 * Linux Mint Debian Edition


 * Arch Linux


 * Manjaro

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
Most of these numbered steps come from a user called 'Tomza', you can find his blog post on this issue on his blog for reference.

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

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

You should install it to use PlayOnLinux

The reason for this warning could be that PlayOnLinux would add the natively installed Wine as one of available Wine versions. This should cause no problems.

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.

Click OK

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

Install Windows fonts

Linux does not come with all fonts native to Windows.

Click Next


 * When all is ready

You should see:

Enjoy using PlayOnLinux

Managing wine versions
1. From PlayOnLinux's window header choose "Tools" -> "Manage Wine Versions".

2. Choose a recent 32bit Wine version, Unity 3D editor won't be 64bit until Unity 5.

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.

3. Click the arrow to install your version of Wine

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


 * 1) !/bin/bash


 * 1) Date : (2014-03-07 10-21 am)
 * 2) Last revision : (2014-04-10 3-12 pm)
 * 3) Wine version used : 1.7.16
 * 4) Distribution used to test : OpenSuse 13.1
 * 5) Authors : waneck-six, Damian-LinuxFan, Tomza (pogtoma@gmail.com), gnumaru
 * 6) Contributors: Goran Grncaroski (running MonoDevelop), other people (testing solutions)
 * 7) Script licence : GPL v.2
 * 8) Only For : http://www.playonlinux.com
 * 9) Depend :


 * 1) Known Issues : Asset Store window does not work at all

[ "$PLAYONLINUX" = "" ] && exit 0 source "$PLAYONLINUX/lib/sources"

TITLE="Unity 3D" PREFIX="Unity3D" WINE_VERSION="1.7.16"

POL_SetupWindow_Init POL_Debug_Init

POL_SetupWindow_presentation "$TITLE" "Unity" "http://www.unity3d.com/" "waneck-six, Damian-LinuxFan, Tomza, gnumaru" "$PREFIX"

export WINEARCH="win32" POL_Wine_SelectPrefix "$PREFIX" POL_Wine_PrefixCreate "$WINE_VERSION"
 * 1) create prefix

POL_Wine_InstallFonts POL_Call POL_Install_directx9 POL_Call POL_Install_dotnet20 POL_Call POL_Install_dotnet35 POL_Call POL_Install_dotnet40 POL_Call POL_Install_tahoma POL_Call POL_Install_vcrun2008 POL_Call POL_Install_vcrun2010 POL_Call POL_Install_mono210 POL_Call POL_Install_d3dx9_36 POL_Call POL_Install_d3dcompiler_43 POL_Call POL_Install_dxdiag POL_Call POL_Install_dxfullsetup POL_Call POL_Install_physx POL_Call POL_Install_corefonts POL_Call POL_Install_msxml6 POL_Call POL_Install_wininet POL_Call POL_Install_ie8
 * 1) setup prefix

Set_OS "winxp" "sp3"
 * 1) Setting OS wer

POL_Wine_OverrideDLL "native, builtin" "mscore" POL_Wine_OverrideDLL "builtin, native" "dnsapi" POL_Wine_OverrideDLL "" "mscorsvw.exe"
 * 1) Setting mono forcing in MonoDevelop

mkdir -p $WINEPREFIX/drive_c/users/$USER/AppData/LocalLow

regfile=$(mktemp --suffix=.REG) echo "REGEDIT4" > $regfile echo "" >> $regfile echo "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion]" >> $regfile echo '"ProductId"="12345-oem-0000001-54321"' >> $regfile
 * 1) registry

POL_Wine regedit $regfile

POL_SetupWindow_browse "Please select the location of the Unity3D setup executable" "$TITLE"

UNITYLOC=$APP_ANSWER POL_Wine $UNITYLOC

POL_Shortcut "Unity.exe" "$TITLE"

POL_SetupWindow_Close exit

Note: depending on your installed wine versions edit the script and change the Wine version before running the script

For example, the script has Wine version at Wine 1.7.16, so change it to:

POL_Wine_PrefixCreate “Your.Version.Number”

Save, that’s all.

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.

5. From PlayOnLinux's window header choose "Tools" -> "Run a local script".

6. Choose the script that was made for automating the installation process of Unity3D and click Next.

7. You will see the warning that the signature of the script isn’t valid. Ignore it! Click Next.

8. You will be able to review your script and check if its content is OK before running. If OK, check I agree and click Next.

9. 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

9. When you run PlayOnLinux for the first time, some extra software may be installed

The installation is ongoing – it isn’t too easy and you may see some errors because and probably will be forced to install some additional software in vitual disk.

After our tests, we know that to run Unity3D and MonoDevelop with no problems, we need all .NET versions installed in Wine. They are all added automatically within the script.

PlayOnLinux is installing the components it needs for Unity3D and MonoDevelop working on Wine. The list of their names is included in the script you are using. They are really important, so wait to the end of the installation patiently.

10. When the script in PlayOnLinux installs up all the components in Wine, find the Unity3D setup executable on your disk through the PlayOnLinux window.

11. Install Unity3D with using PlayOnLinux (just like under Windows). Follow the instructions you see during the Unity3D installation. You may install AngryBots project to test your installation of Unity. Among others, you need NET Framework 4.0 Extended. All will be installed automatically. Do not worry about errors too much if any – maybe they aren’t so important. PlayOnLinux can be even hang up. In such case reboot PlayOnLinux.

12. Click Finish on the Unity3D installation wizard.

When Unity3D is installed inside PlayOnLinux, you see the Unity3D icon in the main PlayOnLinux window – you can start Unity3D from here if you want.

13. You can see two Unity3D icons on your desktop. The called simply "Unity" might not work, which is installed by the Unity installer. "Unity3D" is the one created by the script.

Warning: If you reinstall Unity3D (install again on the same computer), it’s good to remove the remaining shortcut on your desktop (one of the two). One is removed automatically, but the second remains. It can make problems for making a new shortcut for a new Unity3D installation. You may do that even during Unity3D installation, but before the end of the installation because the new shortcuts are made in this time. If you don’t do that, your installation can be corrupted. You will see only one shortcut on your desktop. But this shortcut probably won’t work.

14. Do everything Unity3D wants from you (Activate your Unity License – free or pro; log in to your Unity3D account – you should have the account; if don’t, make one; then, click Start using Unity).

15. When you see the dialog (Project Wizard) for creating or opening a new project for Unity3D, 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.

16. Unity3D is now running.

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, in this case 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 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.

Unity Asset store does not work (Unsolved)
Reported by all that the Asset store window/tab shows up gray, but some elements on the window are picked up judging from that the mouse cursor changes.

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

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 (These are made available when adding ppa:xorg-edgers/ppa repository)

Most likely culprit:

NVIDIA graphics drivers, as this does not occur on Nouveau graphics drivers.

How to solve:


 * 1) Enable "Strict Draw Ordering" in PlayOnLinux's configuration of Unity. This might impact performance.

Or


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

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.