2024-12-08 Running Modular Avatar on other apps
This page was mainly written in 2024-12-08. The information below may quickly become obsolete.
Hello, if you're trying to run Modular Avatar on applications other than VRC, here's what I learned when trying myself.
Modular Avatar V1.x is almost already compatible
Modular Avatar V1.x is almost already compatible with apps other than VRC, but some VRC-specific functionality will be removed.
This is because most of the code specific to VRC is already disabled in Modular Avatar if the VRC SDK is not detected in the project.
For example, MA Merge Armature will run because it's generic, but MA Menu Item will not because it's too specific to VRC.
All sections below describe the work needed to make it compatible.
Modular Avatar sometimes has compilation errors in some releases
Modular Avatar is only officially supported on the VRC platform, so in some releases, there may be compilation errors because some code paths without VRC had been overlooked.
Fixing this often requires adding #if MA_VRCSDK3_AVATARS and #endif at the right locations to make the compiler
ignore imports, field declarations, or entire code blocks that are too specific to VRC.
If something requires context.AvatarDescriptor, you could probably assume most of the contents of the function could be removed from compilation.
See this pull request as an example.
If you use ALCOM / VCC, installing Modular Avatar will install the VRChat SDK
Installing Modular Avatar V1.x through VCC or ALCOM will also install the VRC SDK in the project. This is not desirable, you must not have the VRC SDK in a non-VRC project because the VRC SDK contaminates the project configuration and its build process (layer names, XR project settings, etc.), which will interfere with the functionality of your targeted app.
If you use ALCOM package manager, you can:
- Close the Unity project,
- Install Modular Avatar,
- Uninstall the VRC SDK Avatars package,
- Uninstall the VRC SDK Base package.
If you use VCC, you can't uninstall the VRC SDK package once it is installed. Either switch to ALCOM, even if it's just for non-VRC projects, or install Modular Avatar manually through the source. You will also need to install NDMF.
If you use neither ALCOM nor VCC, you can install it directly through the source. You will also need to install NDMF.
I've been told that in the future, Modular Avatar V2.x will no longer cause the VRC SDK to be installed in the project when it is installed.
Modular Avatar depends on DLLs
Modular Avatar requires some DLLs to be present in the project, which are shipped by default in the VRC SDK.
These DLLs are often absent from other projects like ChilloutVR or Basis.
Try to install Chillaxins through ALCOM, or install those DLLs yourself from Microsoft NuGet (System.Collections.Immutable, Lib.Harmony).
The DLLs are:
- System.Collections.Immutable DLL, because NDMF uses it.
- Lib.Harmony DLL, because NDMF 1.5 uses it.
Modular Avatar depends on the Unity Burst package
Modular Avatar requires the Unity Burst package in the project, which is normally included automatically by the VRC SDK.
Try to install Chillaxins through ALCOM, or go to Unity's package manager, and add Burst to your project.
Connect NDMF to the build process
To ensure Modular Avatar runs when the avatar is being built, you need to connect NDMF to the build process.
In the ChilloutVR application, I've done it in Chillaxins (install it through ALCOM), see this code.
In the Basis framework, see this code. This is already included in the Basis source code itself.