Dynamic character system is under UMA\Extensions\DynamicCharacterSystem Scenes are under the Example/Scenes folder.
Wardrobe pieces are simply recipes that are set to Recipe Type "Wardrobe". Wardrobe Recipes can contain any number of slots and overlays, and are assigned to a specific "Wardrobe Slot" that is race specific - these are defined on the RaceData. Races are preconfigured with the most common wardrobe slots.
Adding a recipe to a slot removes whatever was previously at the slot. (So putting on a helmet, for example, removes the previous helmet.) Wardrobe Recipes can also be set to suppress another slot (for example, putting on the helmet can also suppress the Hair.)
Wardrobe recipes can also Hide parts of the base recipe. For example, putting gloves on the hands slot can hide the base models hands. This solves the "poke through" issues that can occur, and lowers resource usage.
The system manages this all by merging recipes when the avatar is built. A base slot can appear in any number of recipes. for example, you might have a "face" recipe that contains the head slot, and a "beard" recipe that also contains the head slot. The merging process will correctly apply the beard after the face during the build process.
"UMA DCS Demo - Simple Setup". This shows how to create a DynamicCharacterAvatar, and add wardrobe pieces, set colors, and adjust DNA. It's probably all you need for a single-player game.
"UMA DCS Demo - Using Asset Bundles". This is a more powerful demo that has the ability to download asset bundles, and add races and clothing on the fly.
"UMA DCS Tool - DNAConverterBehaviour Customizer". This demo allows you to edit the DNA Converter Behaviours.
Setting Wardrobe recipes in script
To set a wardrobe recipe in script, all you need is the function:
DynamicCharacterAvatar.SetSlot( UMATextRecipe "wardrobe recipe" )
This will attempt to apply the named recipe (looks for compatible race and appropriate slot).
After setting the wardrobe recipe, the changes will not take affect until you call:
This is so the user can make several changes before attempting to rebuild the UMA.
Finally, to clear a wardrobe recipe, simple call;
DynamicCharacterAvatar.ClearSlot( string "wardrobe slot name" )
The "wardrobe slot name" is the location that the recipe is set to, for example "chest", "head", or "hands".
Wardrobe Recipe Asset
Using the UMA DCS - Simple Setup Scene, do the following.
- Import this free asset into the project
- Create a new folder at the root called ‘recipes’
- Right click on recipes folder and choose create->uma->dcs->wardrobe recipe
- Name the recipe military hat
- The first step is to choose which races are compatible with the recipe. You can drag races here from the project explorer, but it’s easier to click the box and pick them from the window the pops up. See the races section for more details on how to decide what races to pick.
- Pick something user-friendly for the display value such as “camouflage hat”.
- The wardrobe “slot” is not a slot in the traditional sense of an uma slot, that is, it’s not a mesh. The wardrobe slot, here simply means the place on the character the item should be placed. Since we’re building a hat recipe, choose helmet.
- The “suppress wardrobe slot” list allows us to specify slots (meshes) on the UMA that should not be displayed. In our case, we may end up needing to suppress the hair on our UMA because it may poke through our hat. So, select the hair to be suppressed.
- The “hides base slot” list is similar to suppressing but works on base meshes. For instance, if our hat had ear flaps for keeping the ears warm in winter, we would set the hide base slots to hide the ears so they didn’t show through the hat.
- The “replaces” list allows the mesh item to entirely replace a part of the base mesh, but keep the overlays already assigned to it. This can be used, for example, when replacing a low-poly mesh with a high poly version when additional detail is needed.
- The next step is to setup the slot and the overlay. The slot is the mesh that is displayed in the game, the overlay is the material the is applied to the mesh.
- To find the slot, navigate to UMA->Content->Ruby-Military militia->Male_PBR-Slots-HumanMale_Mill_SeparatedUVs->Mill_Hat. There you will find a file called Mill_hat_slot. If you click on that file, you’ll see that it has a script type of “SlotDataAsset”. As that would imply, we’re going to drag that onto the box in our recipe that says “Drag Slots here. Click to pick” in our recipe. We should now have some more options below that where we can now add our overlay
- As mentioned above, we now have to add our overlay, that is, the material for our mesh. Navigate to UMA->Content-Ruby->Military militia-Male_PBR->FBX-Overlays->HumanMale_Mill_SeparatedUVs->Hat_Cap_Var01. I picked Mill_hat_cap_var04 to use for my overlay. I noticed that several of the overlay assets were missing some of their textures, so probably best to use the same one to be safe. Drag that asset to where it says “None (overlay Data Asset)” in the Add Overlay section of the Mill_Hat_cap foldout.
- That concludes setting up our recipe. Now that we have our recipe set up, we have to make sure the UMA dynamic character system knows about it. UMA keeps track of everything in a series of libraries. They are access via the UMA menu. UMA-> UMA global library.
- Both the new recipe and the new hat assets (the slot and the overlay) must be added to the global library. This is really easy to do. Just drag the folders to the grey box that says “Drag Indexable assets here. Non indexed assets will be ignored.” The UMA system is smart enough to sift through whatever folder structure you drag onto that box and find things it doesn’t know about. So, just drag your top level “Recipes” folder and your top level “UMA” folder (where the Ruby assets were imported) onto that grey box and UMA will take care of the rest.