Unity3D - ArchWiki

# Unity3D

From ArchWiki
Jump to navigation Jump to search

From Unity - Game engine, tools and multiplatform:

  Unity is a flexible and powerful development platform for creating multiplatform 3D and 2D games and interactive experiences. It's a complete ecosystem for anyone who aims to build a business on creating high-end content and connecting to their most loyal and enthusiastic players and customers.

Not to be confused with Canonical's Unity.

Note: The Linux Editor is currently experimental. Please report all bugs to the Unity forums!

## Installation

Simply install the AUR package unity-editorAUR, unity-editor-betaAUR for the beta version or unity-editor-ltsAUR for the lts version.

Warning: The Unity package is huge. For a successful installation you'll need about 17GiB of free space for the package building, and another 8GiB for it to install.
Note: By default the PKGBUILD redirects all the output of the installer, which downloads and processes about 2GB of data. As this process can be very long it might be useful to monitor it by using `tail -f /tmp/Unity.log`

### Android Support

Install unity-editor-androidAUR, unity-editor-beta-androidAUR or unity-editor-lts-androidAUR depending on your install choice.

### Alternative Installation Method

Unity has made available a program called Unity Hub that is designed to streamline your workflow by providing a centralized location where you can manage your Unity Projects and simplifies how you find, download, and manage your Unity Editor installs. The application comes available as an AppImage. To install the Unity Hub simply install the unityhubAUR package.

## Android Remote

Unity Remote is an Android app to help test input for Android devices. It achieves this by sending a compressed screenshot to the device each frame.

### Prepare computer

#### Install packages

Install the android-udev package, which will ensure you have correct udev rules for your device.

Install the android-sdkAUR package.

#### Configure the Editor

Open the editor, navigate to Edit -> Preferences and set the correct paths to the Android SDK and the JDK.

Tip:

- The Android SDK is usually in `/opt/android-sdk`.
- The JDK varies by the version you are using, if you want to use the default set it to `/usr/lib/jvm/default`.

The navigate to Edit -> Project Settings -> Editor and set `Unity Remote Device` to `Any Android Device`.

For more help see the Unity documentation.

### Prepare Android

Install Unity Remote 5 from the Play Store. Alternatively you can download and build it yourself from the Asset Store.

It is also recommended to set your Android device to PTP mode.

Note: Don’t forget to turn on “USB Debugging” on your device. Go to Settings -> Developer options, then enable USB debugging. As of Android Jelly Bean 4.2 the Developer options are hidden by default. To enable them tap on Settings -> About Phone -> Build Version multiple times. Then you will be able to access the Settings -> Developer options.
Tip: For some devices the remote doesn't work if "Stay awake" is disabled. If you have any problems, make sure to enable it by going to Settings -> Developer options, then enable "Stay awake"

For more help see the Unity documentation.

### Test

If you have Unity opened, close it.

Connect the phone to the computer and launch Unity Remote.

Open the Editor and press play. You should now see your game transmitted to your Android device.

If it doesn't work or you have questions, see the Unity Documentation.

## Visual Studio Code

For those using the Visual Studio Code as their script editor, there are a few additional steps you need to do to get it running without displaying errors similar to:

    [fail]: The reference assemblies for framework ".NETFramework,Version=v3.5" were not found

    [warn]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo Unable to create directory "/Debug/". Access to the path "/Debug/" is denied.
    [fail]: OmniSharp.MSBuild.ProjectFile.ProjectFileInfo Could not write lines to file "/Debug/Assembly-CSharp.csproj.CoreCompileInputs.cache". Could not find a part of the path "/Debug/Assembly-CSharp.csproj.CoreCompileInputs.cache".

To eliminate these errors you need to install the following packages: dotnet-runtime, dotnet-sdk, msbuild-stableAUR, and mono. Finally remember to install the C# extension from the VS Code Marketplace by pressing Ctrl-P and entering:

    ext install ms-vscode.csharp

## Troubleshooting

### Unity crashes on first launch before/while signing in

This is a rare bug where Unity's configuration gets created wrongly. You can try resetting it by:

    $ rm -rf ~/.config/unity3d/{*.prefs,*.log,Preferences}

### Unity crashes when trying to load project

Users have reported that unsetting `GTK_IM_MODULE` prevents the crash.

### Unity crashes if ~/.config/user-dirs.dirs is missing

See how to generate the xdg files here: XDG user directories

### Minor stuttering while playtesting (NVIDIA)

Vsync does not seem to work correctly with NVIDIA graphics cards / drivers. Solution: In nvidia-settings go to "OpenGL Settings" and turn off "Sync to VBlank".

The behaviour occured/noticed when used "transform.Rotate" in combination with "Input.GetKey".

### Error: Multiple Unity instances cannot open the same project

Unity probably did not shutdown properly, in this case you should navigate to your project folder and delete Temp folder.

### Android Remote not working / Running Android build fails with "Unable to forward network traffic to device"

Try this workaround :

1. Close Unity.
2. Shutdown adb daemon with `adb kill-server`
3. Plug in the android device.
4. Find your device ID with `adb devices`
5. Use `adb -s "deviceID" forward "tcp:34999" " "` replacing `"deviceID"` with the correct one.

That's it now you can open unity and test it, an error "socket bind failed" will appear that you can safely ignore.

Categories:

- Development
- Gaming