I've read a number threads regarding how to use UMA with ORK but nothing that fully explained the proper setup. For instance, if we have to make UMA our prefab in order to get it to work, is that to say that we can set the actual base UMA prefab itself, as included in the installation, to be our prefab and then add its initial scene as part of the character generation process, or does it need to be created beforehand and exported with all of its equipment and mesh states pre-attached. Just a bunch of miscellaneous questions like that. Any chance on getting a quick and dirty set of steps to point me in the right direction here, at least on the ORK end? I know I can't be the only person interested in this.
  • You can create your own UMA prefab from scratch, or you can duplicate the included UMADynamicCharacterAvatar.prefab asset and use that as a base.

    Drag your UMA prefab into the Scene View and then run the UMA Bone Builder (from the Tools menu, I think) on it. This will generate the UMA humanoid skeleton within the prefab, allowing you to set any required references to specific bone transforms and to set up additional components on particular bones, such as ORK Equipment Viewers.

    When it comes to equipment shown on the character model, you'll generally be using UMA for clothing and armor, but attaching separate meshes to the hands for weapons and shields. So when I'm setting up a UMA for use as an ORK Combatant prefab, I'll add the Equipment Viewers needed for the left and right hands to their corresponding bones, and then I just create an empty GameObject as a child of the prefab's root object named "Equipment Setup" or something like that. I add the rest of the Equipment Viewers to this object, as it's just extra work to put them all on specific bones when it doesn't actually make any difference. But you can do it that way if you like; it won't hurt anything.

    Equipment prefabs for clothing, armor, etc that will be added to the character using UMA can just be empty GameObjects with this component attached to them:
    using UnityEngine;
    using UMA.CharacterSystem;


    namespace MyGame.Integrations.UMA_DCS
    {
    public class DynamicEquipmentItem : MonoBehaviour
    {
    [SerializeField]
    private string wardrobeSlot;

    [SerializeField]
    private UMAWardrobeRecipe _maleItemRecipe;

    [SerializeField]
    private UMAWardrobeRecipe _femaleItemRecipe;

    private bool _isAdded = false;
    private bool _isRemoved = false;

    private DynamicCharacterAvatar _avatar;
    private bool _useFemaleRecipe;

    void Start()
    {
    _avatar = GetComponentInParent();

    if (_avatar == null)
    {
    Debug.Log("DynamicEquipmentItem: Could not get DynamicCharacterAvatar component!");
    return;
    }

    _useFemaleRecipe = _avatar.activeRace.name.ToUpper().Contains("FEMALE");
    EquipItem();
    }

    private void EquipItem()
    {
    if (_useFemaleRecipe)
    {
    if (_femaleItemRecipe == null) { return; }
    _avatar.SetSlot(_femaleItemRecipe);
    }
    else
    {
    if (_maleItemRecipe == null) { return; }
    //Debug.Log("DynamicEquipmentItem: Equipping " + _maleItemRecipe.DisplayValue);
    _avatar.SetSlot(_maleItemRecipe);
    }

    _isAdded = true;
    _avatar.BuildCharacter(true);

    }

    private void OnDisable()
    {
    if (_avatar != null)
    {
    _avatar.ClearSlot(wardrobeSlot);
    _avatar.BuildCharacter(true);

    }

    _isRemoved = true;
    }
    }
    }
    To use this component, just enter the name of the UMA Wardrobe Slot that the item is equipped to, and then assign references for the male and female recipes.

    When an item is equipped, the ORK Equipment Viewer will instantiate this prefab (since there's no mesh attached, it doesn't really matter where it creates this on the character) and the Start() method will execute and assign the appropriate wardrobe recipe to the UMA character.

    I have yet to actually get to the point of needing to build a character creation screen, but I would probably take one of the demo scenes as a base and then modify it.
  • Thanks for this reply, Keldryn. And for the script! Please advise whether you give permission to use it in a commercial title. I haven't had a chance to test it out, but I did set aside a small chunk of time last week to fiddle a bit with the UMA avatar, trying to get it to work inside of the ORK base demo. The main thing giving me trouble at the moment is the character controller. Two major questions regarding that:

    -Is there a special procedure for attaching the ORK controller that will get it to work with UMA? My current setup places UMA inside an empty object, and I've tried attaching it to there as well as the avatar itself without any luck.

    -What settings, if any, should I be mindful of regarding the integrated UMA animation controls? I'm thinking it might be one of the reasons my character shoots off like a floppy guided missile across the screen whenever I prompt it to move. I'm testing with no collider, or anything else apart from the ORK controller, so my guess is the problem lies somewhere in a faulty setup concerning either one, or both of these areas.
  • ThreeNippledWanda said: Please advise whether you give permission to use it in a commercial title.
    Yes, use it, modify it, whatever you like. :-)
    ThreeNippledWanda said: Is there a special procedure for attaching the ORK controller that will get it to work with UMA? My current setup places UMA inside an empty object, and I've tried attaching it to there as well as the avatar itself without any luck.
    I don't think there is anything special. Check the "additional recipes" section on the UMA prefab; the default prefab includes a recipe which adds a Capsule Collider (I think). Just check all of the recipes added to the default prefab and remove any that add a collider, rigidbody, or character controller.

    It's been a few months since I've worked with UMA, but I believe that the "default race animator" set on the UMA prefab will overwrite the animator controller that you specify in the Animator component, so you may need to assign your animator controller there as well.

  • "I don't think there is anything special. Check the "additional recipes" section on the UMA prefab; the default prefab includes a recipe which adds a Capsule Collider (I think). Just check all of the recipes added to the default prefab and remove any that add a collider, rigidbody, or character controller."

    -Hmm, I don't see an extra collider. When I spawn a separate UMA by itself all I see is the mesh and a box for the empty game object that holds it. Also, the ORK components are added, Like UMA, at runtime, but their placement is wonky so I'd rather set them up manually as part of the prefab... only there's no prefab until UMA generates. So, can I add them to the empty game object that holds my UMA script? It seems to work okay now with the controller just for moving around, but I haven't tacked the quintessential bundle of extras yet.

    "It's been a few months since I've worked with UMA, but I believe that the "default race animator" set on the UMA prefab will overwrite the animator controller that you specify in the Animator component, so you may need to assign your animator controller there as well."

    -'Race Animation Controllers Default Animation' is set to 'none' and stays that way when the game is running. I don't see an option to add the ORK Legacy Animation Controller. The Race I'm using to test is the standard HumanMale, not the DCS version. Will your script work with either/or?
  • edited October 3
    ThreeNippledWanda said: The Race I'm using to test is the standard HumanMale, not the DCS version. Will your script work with either/or?
    Yeah, it will work fine with HumanMale. There isn't much difference between HumanMale and HumanMaleDCS; when DCS was first added, you had to use the "DCS" variants, but the base/standard races were changed to be compatible. I think the "DCS" races are primarily there so as not to break compatibility for people who started using them before the standard races were made compatible with DCS.
    ThreeNippledWanda said: Hmm, I don't see an extra collider. When I spawn a separate UMA by itself all I see is the mesh and a box for the empty game object that holds it.
    I noticed that I've actually still got a Release Candidate for UMA 2.7 on my system, rather than the final Asset Store version, so it's possible that things may have changed. This is what my UMADynamicCharacterAvatar prefab (in UMA/Getting Started) looks like:

    image

    This adds a Capsule Collider to the generated character (at runtime, so you won't see it in on the character unless the game is running). It also sets the default UMA "Locomotion" animator controller to the character's Animator component. Even if you specify an animator controller on the Animator component, it will overwrite it with the default race animator controller. I've brought that up on the UMA development Slack -- it should only apply the animator controller if there isn't one specified on the Animator component, so it may have been changed at some point.

    Anyway, I'll walk through how I normally set it up.

    1. Drag the UMADynamicCharacterAvatar prefab into the scene.

    2. Rename it (I named it "Player_DCS")

    3. Run the Bone Builder tool (UMA => Bone Builder). Assign the Player_DCS scene object and click "Generate Bones."
    image

    It should now look like:
    image

    The Bone Builder tool made many integrations much, much easier, as anything that needs to be set up on the skeleton can be done at design time instead of via script.

    4. Get rid of the Capsule Collider Recipe (just set Additional Unity Recipes -> Size to 0)

    5. Replace the Default Race Animator Controller with the one you want to use. Also assign it in your Animator component as well (the Bone Builder should have added it to the prefab)

    image

    6. Add an Equipment Viewer for the Right Hand slot. I like to create an empty GameObject as a child of the Right Hand bone and then place the Equipment Viewer component on that object. That way I can use one set of position/rotation values for each item and just adjust the viewer GameObject for each character model (not so much an issue if you're only using UMA characters).

    image

    7. Do the same for any other Equipment Viewers that attach a static mesh to the character's skeleton.

    8. For the items that are placed on the character through UMA, I find it's a waste of time to mess around placing Equipment Viewers on individual bones (although there's no reason you can't do it that way). So I just create an empty GameObject directly under the Player_DCS prefab, name it "Equipment Setup", and place the Viewers for the other slots there (Helmet, Torso, Boots, Gloves, etc). Since my script (above) doesn't instantiate any meshes, there's no real difference placing all of these on one child object.

    9. Add any other components that you need which ORK isn't adding automatically (say a NavMeshAgent for NPCs or if you're doing point-and-click movment, 3rd party character controllers that require a significant amount of configuration, etc).

    10. Make a prefab out of Player_DCS.

    Once you have the one UMA character prefab configured the way you want, it's easy to just duplicate it (CTRL-D) and tweak the recipe it loads for different characters. At some point, I'll write up a script that just pulls the recipe name to load out of a string variable on a Combatant (so you don't need a different prefab for each character), but I haven't gotten around to that yet.

    Let me know if you run into any problems.

    Post edited by Keldryn on
Sign In or Register to comment.