UMA and its Advantages
One huge advantage of developing in Unity is the humongous selection of packages. Either free or expensive, you can probably find a package on Unity to help you out with any kind of game, whether it is a simple shooting package or a complex voxel system. Of course, for SideTracked we take full advantage of this aspect of Unity.
One such package that is helping us with development is UMA. Standing for Unity Multipurpose Avatar, UMA helps with multiple character systems like customization or equipment. Basically, instead of just attaching a 3D model to a prefab, you can instead give it a UMA script which will spawn in a set model for you at runtime. You may be wondering “Why would I want that if I could just use what’s already in Unity?”. It certainly is true that unity comes with animation controllers and 3D model support built-in but UMA has several advantages that make it a serious powerhouse asset.
The largest advantage of UMA is that it can alter the mesh of the model as you make runtime changes. If someone wanted to implement player clothing in Unity without UMA, there are many ways to go about it. They could have a full player model made for each different set of clothing that the player could wear, and swap it out when they make a change. This is pretty wasteful in terms of memory though: you are saving multiple copies of the same model but with just one thing changed.
Alternatively, they could have the gear as separate models and just throw the gear on top of a nude player. This is much better in terms of memory but comes with its share of problems. Firstly, stuff like hair can poke through the clothing. There is no way the average helmet model can effectively cover fancy anime hairstyles on their own. Another issue with this is that you are still rendering the player underneath the clothing. What is the point in spending processing power drawing the face of a player if they are going to wear a helmet that hides it the whole game? It may not seem like a particularly big deal, but in a game like GTA that has 20-30 high-resolution NPC’s on the screen at once, it can make a big difference.
This is where UMA comes in: UMA can hide the mesh underneath the clothing, helping with performance significantly. It will take the player models and clothing that it is given, and combine them into one mesh cleanly, hiding only the hidden parts. Plus, it comes with nicely made scripts that can help you with adding and altering the models. By interacting with the script, you can add components or change characteristics of the model at runtime, which can be super useful. UMA makes implementing a character creation system very easy: if you have the models, you can have gear or clothing pop right onto the character with just one or two lines. UMA also comes with a ‘DNA’ feature which allows you to change the bones or morph shapes of a runtime model through the script, letting you change the very shape of the underlying player model.
However, UMA isn’t perfect. All models that are used for UMA need to be very carefully rigged for them to work. Certain bones with very specific names need to be added, and the clothing and equipment need the same bones to work. This means that if your model came with any animations, they need to be adjusted to work with the fancy new bones. Additionally, to set up a UMA character, you need many extra scripts and assets for it to register. If you want to use a custom shader with UMA, you need to create extra bridge assets to connect them. If you miss any of the many tiny requirements or configurations, your UMA will be stuck in a T-Pose, without any indication of why. Unfortunately, the documentation isn’t always able to help and there are very few video tutorials that help you through it. UMA is a difficult package and takes a while to get used to.
Despite all of these issues, the advantages of UMA far outweigh the difficulty of using it. The ability to have customized multipurpose avatars is a fantastic asset to a large RPG project like SideTracked. Now that it has been integrated, we can produce new UMA characters for players, enemies or even perhaps trains.
Is there something you want to see customized in SideTracked? Leave us a comment and you might just see it as a UMA in the future.