Mux provides data binding infrastructure to Unity.
Mux is useful as a powerful UI toolkit on Unity, integrated with Mux.Markup.UI.
- Fully Open-source including dependencies (except Unity itself)
- Text-based representation
- No more clicking and dragging
- Easy to merge
- Fully managed
- Full stacktrace
- High portability
- High stablity
- Less overhead
- Easy to migrate to/from uGUI
- Powers Unity Editor Inspector
- Has rich documentation
- Proven data template/data binding infrastructure for UI
- Has rich documentation
- Familiar for Xamarin.Forms/WPF developers
- High maintainability
- Hot Reload
- Fast iteration
Unity Editor must be 2020.2 or possibly newer.
First, add this repository to the
Project manifest as
com.pixiv.mux, a dependency.
You will need Mux.Markup.UI (
com.pixiv.mux.markup.ui) if you would like to integrate Mux with uGUI. Mux.Markup.Animation (
com.pixiv.mux.markup.animation) is for animation.
The target framework must be ".NET 4.x".
The following APIs are available:
System.Collections.Immutable "provides collections that are thread safe and guaranteed to never change their contents, also known as immutable collections."
Xamarin.Forms XAML Runtime
Xamarin.Forms XAML compiler and markups in MS-XAML-2009 are available. The difference from the original runtime is that it compiles XAML by default.
You can also write your own markup extension using
Xamarin.Forms.Xaml.IMarkupExtension. It can be annoted with
Xamarin.Forms.AcceptEmptyServiceProviderAttribute, just like Xamarin.Forms markup extensions are.
Xamarin.Forms data binding infrastructure
In addition to markups in [MS-XAML-2009], a data binding infrastructure is proted from Xamarin.Forms. Specifically, it includes:
Mux APIs provide Unity-specific runtime services and markups for Unity objects. Its documentation can be built with DocFX.
The playground and caveats
The documentation has a playground and exhibits examples with the component. However, there are something to be noted:
- The playground is built on an interpreter on IL2CPP.
- Managed bytecode stripping is disabled for
Xamarin.Forms.Xamland Mux assemblies.
Building documentation requires the following:
The following subprojects must be prepared as well:
- Mux.Markup.Animation at
- Mux.Markup.UI at
- Xamarin.Forms modified for Mux at
Build target of
PATH environment variable must be configured so that
npx can be resolved.
DocFX template used for the documentation is available at
.docfx_template. It is also used for VRoid SDK documentation.
You need to merge it with the default template of DocFX to make it functional.
Incompatibility with IL2CPP
IL2CPP does not provide the constructor arguments of custom attributes. Due to that restriction, important attributes such as Xamarin.Forms.ContentPropertyAttribute will not work with the interpreter.
A workaround is to use the compiler.
Normal data binding relies on reflection, and Unity linker fails to figure out dependencies on a property. You have two options to resolve the problem:
Configure Unity Linker accordingly to prevent properties from being stripped.
CodeFormatter /copyright:Copyright.txt CodeFormatter.rsp
Provide documentations for public APIs. Please make sure DocFX does not emit any warnings nor errors.
Provide cross references to Unity with hyperlinks. You should check if the number of unresolved uid is increased by passing
--logLevel Verbose when building the documentation.
Xamarin.Forms internal dependencies
Although modifications of Xamarin.Forms made for Mux is minimal, Mux depends on a number of internal interfaces:
- Xamarin.Forms.Build.Tasks.XamlCTask (Note that Mux uses the task without full MSBuild.)
Changes for those interfaces must be reviewed when altering Xamarin.Forms libraries.
Mux includes external dependencies. You can remove existing dependencies and recreate.
Clean target of
.build/Mux.msbuildproj to clean all dependencies.
Build target on Mono to recreate.
Licenses directory or "Licenses" article of the documentation.