Unity

Unity #

This article will take you through installing Unity Hub, Unity, and ALCOM (the FOSS alternative to VRChat Creator Companion).

Set up UnityHub #

Download the UnityHub AppImage. Run the AppImage like you normally would.

Running UnityHub from Flatpak is also still an option, but it seems ALCOM has better integration with the AppImage.

First, take a look at this page from the official VRChat docs about how to install the supported Unity version from UnityHub. We’ll do something similar.

  1. Open Unity Hub and sign in with your Unity account.
  2. Install 2022.3.22 (VRChat’s current supported Unity version, at the time of writing) by running ./UnityHub.AppImage unityhub://2022.3.22f1/887be4894c44.
  3. When prompted, select Android Build Support and Windows Build Support (Mono).
    • You may need to install cpio from your distro’s repos in order to install these components (The AppImage erroneously doesn’t include it). To check if it’s installed, run which cpio in a terminal.

ALCOM #

vrc-get is a native FOSS package manager written in Rust. Its GUI counterpart was formerly known as vrc-get-gui, but has been rebranded as ALCOM (Alternative Creator Companion).

  1. Download the AppImage from the latest “gui” release. Pick the file named alcom-<some version>-x86_64.AppImage.
  2. Run the AppImage.
  3. In the settings tab, under Unity Hub Path, point it to your UnityHub.AppImage.
  4. Create a new project and open it.
  5. Go to VRChat SDK -> Show Control Panel and dock it to the main window.
  6. It may open windows partially offscreen. If this happens, see this section below.

Now you should be able to create and upload avatars and worlds like you normally would.

World & Avatar test builds #

  1. Symlink the VRCSDK’s output folder on Linux into the VRChat wine prefix.

If VRChat is installed in the default location:

cd ~/.local/share/Steam/steamapps/compatdata/438100/pfx/drive_c/users/steamuser/AppData/LocalLow/VRChat/VRChat/

mkdir -p ~/.local/share/VRChat/VRChat/{Worlds,Avatars}

ln -s ~/.local/share/VRChat/VRChat/Worlds .
ln -s ~/.local/share/VRChat/VRChat/Avatars .
  1. Add --watch-worlds and/or --watch-avatars to the VRChat launch options in Steam.
  2. Launch VRC
  3. Test build your world or avatar. VRChat will switch to it automatically.

Advanced: Testing with more than 1 client #

Warning: Do NOT run this with system Wine. It may re-initialize your wine prefix, causing data loss.

Check ~/.steam/root/steamapps/compatdata/438100/config_info for the specific proton version’s bin folder and use the wine from inside there.

This is an example to start VRChat in local test mode, while using GE-Proton9-11-rtsp15 and the default VRChat install location. Change the scene-standalonewindows64-samplescene.vrcw part to match your vrcw filename.

WINEPREFIX=~/.steam/root/steamapps/compatdata/438100/pfx

~/.steam/root/compatibilitytools.d/GE-Proton9-11-rtsp15/files/bin/wine VRChat.exe '--url=create?roomId=2988384194&hidden=true&name=BuildAndRun&url=file:///C%3A%5Cusers%5Csteamuser%5CAppData%5CLocalLow%5CVRChat%5CVRChat%5CWorlds%5Cscene-standalonewindows64-samplescene.vrcw' --watch-worlds

Troubleshooting #

Worlds: AssetBundle was not built #

This error is caused by VRCSDK build incorrectly expecting a mixed-case AssetBundle filename, while Unity outputs a lowercase filename, which fails a file existence check and causes the SDK to abort the build.

To fix this, import WorldSDKPatcher.unitypackage: https://github.com/thegu5/VRCSDKonLinux/releases

Avatars: Local test avatars don’t show up ingame #

The “Build & Test” button on the SDK will create avatar AssetBundles (.vrca). However (and assuming the build succeeds), it writes them to a different location than VRChat’s Proton prefix. Just symlink and try the build again.

ln -sf ../Steam/steamapps/compatdata/438100/pfx/drive_c/users/steamuser/AppData/LocalLow/VRChat/VRChat ~/.local/share/VRChat/VRChat

Shaders fail to include some .cginc files #

This can happen with Poiyomi. It’s caused by case-sensitivity. You may need to edit the shader files directly. Open them in any text editor, and correct the casing of filenames.

Editor windows appear partially offscreen #

Unity may open undocked panel windows (such as color pickers and unitypackage import dialogs) partially offscreen.

Some workarounds:

  • For KDE, hold the Meta (AKA Super, AKA WinKey) key and click anywhere in the window to drag it back onscreen.
  • Alt-Tab to the specific window, then press Meta-Right to snap the window to the right side of the screen.
  • For KDE, press ALT+F3 -> More Actions -> Move.

Can’t drag-and-drop files from external programs #

Rather than using Assets -> Import New Asset or Import Package, it’s normally possible to drag-and-drop a unitypackage or other asset from a file browser directly into Unity’s Project pane, where it will be copied to the Assets folder.

However, if your file browser is running on Wayland, this will show “Failed copying file” errors.

See issue flathub/com.unity.UnityHub#97.

As a workaround, launch your file browser in Xwayland mode. Unity will accept the file as it should.

WAYLAND_DISPLAY="" dolphin

When Unity is opened via ALCOM, it crashes when dragging a hierarchy object #

Note: If you are on Nvidia, see the Crashing frequently with Nvidia section first.

An ALCOM-launched instance of Unity can crash after trying to drag-and-drop an item (within Unity, ie. not external programs).

This issue #1346 was fixed by ALCOM v0.1.14, so just update.

Analysis: ALCOM has a different environment than the rest of your system, mostly by virtue of being an AppImage. This means the Unity subprocess that it spawns was implicitly inheriting its crummy vars. Unfun fact: This environment inheritance causes several other problems (such as ignoring the user’s GTK theme for menubars and context menus, especially on a KDE system), but I’m not sure the cleanest way to unset those vars yet. A wrapper script around the Unity binary?

VRCFury builds lock up the editor #

Maybe due to the windows offscreen issue mentioned above, when starting build or play mode, the VRCFury progress window may initially be invisible, or pop underneath, which gives the appearance that the build isn’t doing anything and has locked up. Use the “Alt-tab to the specific window then Meta-Right” trick to get the VRCFury progress window to appear onscreen again. That window may also be solid black, but this doesn’t necessarily mean the build has frozen.

Moving file failed #

A dialog may appear upon trying to build an avatar, where none of the buttons are helpful:

Moving Temp/unitystream.unity3d to /tmp/DefaultCompany/Some Avatar Project/prefab-id-v1_avtr_00000000-0000-0000-0000-000000000000_0000000000.prefab.unity3d:

Force Quit | Try Again | Cancel

This seems to happen consistently if the projects are stored on an EXFAT partition. Consider using another filesystem, such as NTFS if you still need projects accessible under both Windows and Linux.

Crashing frequently with Nvidia #

On some systems running Nvidia graphics, the Unity Editor may crash frequently from common actions like importing a unitypackage or dragging a file.

If you launch projects from ALCOM (v0.1.13 or newer): Open ALCOM, go to the “Default Unity Command-line Arguments” setting on the Settings page. Click “Edit”, “Customize”, “Reset”, “+”, then type in -force-vulkan-layers into the new box, then click “Save”.

If you launch projects from Unity Hub: Open Unity Hub, click the ... icon to the right of your project, then click “Add command line arguments”, and add the argument -force-vulkan-layers.

Alternatively, downgrading the Nvidia driver to version 545 may also fix the problem.