lvra.gitlab.io/content/docs/vrchat/unity.md

135 lines
7.7 KiB
Markdown
Raw Normal View History

---
weight: 900
title: Unity
---
# Unity
2024-05-28 05:26:40 +02:00
This article will take you through installing Unity Hub, Unity, and ALCOM (the FOSS alternative to VRChat Creator Companion).
2023-12-10 09:24:10 +01:00
2024-05-28 05:26:40 +02:00
## Set up UnityHub
2024-02-25 01:27:29 +01:00
2024-05-28 05:26:40 +02:00
Download the [UnityHub AppImage](https://public-cdn.cloud.unity3d.com/hub/prod/UnityHub.AppImage). Run the AppImage like you normally would.
2023-12-10 09:24:10 +01:00
2024-05-28 05:26:40 +02:00
Running UnityHub from [Flatpak](https://flathub.org/apps/com.unity.UnityHub) 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](https://creators.vrchat.com/sdk/upgrade/unity-2022/#using-the-unity-hub) about how to install the supported Unity version from UnityHub. We'll do something similar.
2023-12-10 09:24:10 +01:00
1. Open Unity Hub and sign in with your Unity account.
2024-05-28 05:26:40 +02:00
1. Install **2022.3.22** (VRChat's current supported Unity version, at the time of writing) by running `./UnityHub.AppImage unityhub://2022.3.22f1/887be4894c44`.
2023-12-10 09:24:10 +01:00
1. When prompted, select *Android Build Support* and *Windows Build Support (Mono)*.
2024-07-27 23:32:19 +02:00
- 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.
2024-05-28 05:26:40 +02:00
## 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 (***Al***ternative Creator ***Com***panion).
1. Download the [AppImage from the latest "gui" release](https://github.com/vrc-get/vrc-get/releases). Pick the file named `alcom-<some version>-x86_64.AppImage`.
1. Run the AppImage.
1. In the settings tab, under Unity Hub Path, point it to your UnityHub.AppImage.
1. Create a new project and open it.
2023-12-10 09:24:10 +01:00
1. Go to VRChat SDK -> Show Control Panel and dock it to the main window.
2024-05-28 05:26:40 +02:00
1. It may open windows partially offscreen. If this happens, see [this section below](#editor-windows-appear-partially-offscreen).
2023-12-10 09:24:10 +01:00
2023-12-23 13:13:37 +01:00
Now you should be able to create and upload avatars and worlds like you normally would.
2023-12-10 09:24:10 +01:00
2024-05-28 05:26:40 +02:00
<!--
This is no longer maintained.
2023-12-10 09:24:10 +01:00
2024-02-25 01:27:29 +01:00
## Option 2. LinuxCreatorCompanion
2023-12-23 13:13:37 +01:00
2024-05-28 05:26:40 +02:00
If you need some of the GUIs, it is now possible to use VRChat Creator Companion (VCC) on Linux.
2023-12-10 09:24:10 +01:00
2024-02-25 01:27:29 +01:00
The official VRChat Creator Companion uses Webview2 (Microsoft Edge). This component is difficult to install, and doesn't run natively. Instead, you can use LinuxCreatorCompanion.
2024-02-25 01:27:29 +01:00
[GitHub repo for LinuxCreatorCompanion](https://github.com/RinLovesYou/LinuxCreatorCompanion)
2024-02-25 01:27:29 +01:00
It works by using wine to extract the necessary bits to re-embed into a native client application. While experimental, you can enjoy much easier avatar, world, and asset creation. Again, this is experimental, and we discourage you from trying this on important projects. **Remember to make frequent project backups.** Please leave any feedback about bugs or ideas on the GitHub issues tab.
2024-02-25 01:30:36 +01:00
To install, click the releases tab, download the zip, extract it somewhere, and run `./LinuxCreatorCompanion`.
2024-02-25 01:27:29 +01:00
**Note:** If you're using Unity Hub via flatpak, it will have trouble finding and opening Unity. For now, create this wrapper script, chmod +x it, and put it somewhere in your PATH, like `/usr/local/bin/unityhub`.
2023-12-10 09:24:10 +01:00
2024-02-25 01:27:29 +01:00
```bash
#!/usr/bin/env bash
exec flatpak run com.unity.UnityHub "$@"
```
2024-05-28 05:26:40 +02:00
-->
2024-02-25 01:27:29 +01:00
## Troubleshooting
2024-05-28 05:26:40 +02:00
### Worlds: AssetBundle was not built
2024-02-25 01:27:29 +01:00
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.
2024-02-25 01:27:29 +01:00
To fix this, import `WorldSDKPatcher.unitypackage`: https://github.com/thegu5/VRCSDKonLinux/releases
2024-04-10 00:56:53 +02:00
2024-02-25 01:27:29 +01:00
### 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.
2024-02-25 01:27:29 +01:00
### Editor windows appear partially offscreen
2024-02-25 01:27:29 +01:00
Unity may open undocked panel windows (such as color pickers and unitypackage import dialogs) partially offscreen.
2024-02-25 01:27:29 +01:00
Some workarounds:
2024-08-10 08:28:59 +02:00
- 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.
2024-02-25 01:27:29 +01:00
- For KDE, press ALT+F3 -> More Actions -> Move.
2024-02-25 01:39:33 +01:00
2024-08-10 08:28:59 +02:00
### Can't drag-and-drop files from external programs
2024-02-25 01:39:33 +01:00
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](https://github.com/flathub/com.unity.UnityHub/issues/97).
As a workaround, launch your file browser in Xwayland mode. Unity will accept the file as it should.
```
WAYLAND_DISPLAY="" dolphin
```
2024-08-10 08:28:59 +02:00
### When Unity is opened via ALCOM, it crashes when dragging a hierarchy object
{{< hint info >}}
**Note**: If you are on Nvidia, see the [Crashing frequently with Nvidia](#crashing-frequently-with-nvidia) section first.
{{< /hint >}}
An ALCOM-launched instance of Unity can crash after trying to drag-and-drop an item (within Unity, ie. not external programs).
This will likely be fixed by ALCOM v0.1.14.
https://github.com/vrc-get/vrc-get/issues/1346
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 will inherit its crummy vars. The one at fault here is likely `GDK_PIXBUF_MODULE_FILE`. Unfun fact: This causes several other problems too (such as GTK-themed menubars and context menus 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.
<!-- This fix is mentioned in https://discussions.unity.com/t/unity-editor-crashes-frequently-on-linux-vulkan-after-updating-gpu-drivers/941387/10, and appears to be a new issue as of driver version 550 -->