Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

Discussion in 'Assets and Asset Store' started by FernandoRibeiro, Dec 24, 2013.

  1. Deatonjc

    Deatonjc

    Joined:
    Apr 22, 2017
    Posts:
    25
    its loading the uma model now just without the mesh i added

    https://flic.kr/p/25sguS7

    been at this 1 thing for 3 days figured i could use some help
     
  2. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    it says your "gambeson_overlay" is missing a texture in channel 2 ( the third one ). Are you using a 3 channel uma materials (albedo, normal, metallic)? if so, do you have a texture in 3 channels on your overlay? If you're not intending to use 3 textures then you will need to select a different uma material on your overlay and the slot it will be applied to.
     
  3. Deatonjc

    Deatonjc

    Joined:
    Apr 22, 2017
    Posts:
    25
    got it working... not really a technical person https://flic.kr/p/L5tvwJ

    could one of u leave a video where textures are explained specifically normal
     
  4. AsoraX

    AsoraX

    Joined:
    May 3, 2017
    Posts:
    22
  5. Deatonjc

    Deatonjc

    Joined:
    Apr 22, 2017
    Posts:
    25
    U use max? Did you use include all when skin wrapping? I may be off kilter, I'm here for help myself.
    -----------------------------
    Back to my question: Is there a way to use regular unity materials? Or could that be possible in the future? I know y'all got the atlas stuff and the editable textures but i don't believe they are working as well as the unity ones. But if I'm doing something wrong pls explain Cus im using slot 0 for diffuse, slot 1 normal, slot 2 metal. Is this wrong?
     
  6. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Try hiding the base head slot. You're actually using two different head slots, the base recipe head slot which is named "M_High Poly head", then in your recipe you're adding the (older and lower poly) "MaleFace". You could leave as is and hide the base head slot, or change your recipe to use the higher poly head and that overlay on top of it, then it should layer properly.
     
  7. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    UMA uses regular unity materials. If you examine the object with the skinned mesh renderer at runtime you'll see unity materials applied. The UMA Material is a wrapper that links to a unity material and i necessary for the atlassing and combining textures to common unity materials.
    In your last screenshot I can see you're using the "UMA_Diffuse_Normal_Specular" uma material. That's set up to use the standard specular shader not metallic. If your input textures are using the metallic workflow then you need to use an UMA Material that uses that shader, for example "UMA_Diffuse_Normal_Metallic".
     
  8. Deatonjc

    Deatonjc

    Joined:
    Apr 22, 2017
    Posts:
    25
    Okay. I'm trying to make that look like cloth armor but the color chooser messed it up and for whatever reason the normals inverted.. I'm not trying to sound rude I just can't figure it out.. Is there a shader I can use with just diffuse and normal with the default specular levels?
     
  9. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    upload_2018-6-16_8-38-11.png
    Is this what you modified? if so these are the default values.
    If you'd like realtime step by step help, I'd suggest you join the uma slack channel . If you message me your email I can invite you.
     
  10. Vygar

    Vygar

    Joined:
    Dec 20, 2015
    Posts:
    23
    I'm running into a strange issue and I apologize if this has been brought up somewhere in the 136 pages of this thread. When I create an Recipe, set it up, get it working in my game project, close Unity and then re-open it, all of the recipes I created (not copied, create from new) are now broken and missing their references to slots and overlays. I'm on unity vers 2017.4.3f1 and I am using the package currently on the asset store. Is this a known issue or am I doing something wrong?
     
  11. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Are you using the quick "add to global library" button in a recipe to adds the slots and overlays to the global library? If so that is a known issue. It's not actually the recipe but the global library not serializing the references. You can still use the recipes if you add your assets to the library from the global library window (you can drag and drop whole folders). This issue is fixed in the develop branch and will be fixed in future updates.
     
    hopeful likes this.
  12. Vygar

    Vygar

    Joined:
    Dec 20, 2015
    Posts:
    23
    Awesome thank you!
     
  13. mschwarz1

    mschwarz1

    Joined:
    Oct 22, 2013
    Posts:
    7
    Hi, I tend to not post on forums and lurk for answers but so far that hasn't worked. I'm attempting to create my own race following the Secret Anorak tutorials (they are fantastic) but I ran into an issue. After creating the race data, recipes, and a basic slot with an overlay when the character is generated via the UMA DCS Demo simple setup the character kind of crumples in typical janky bone deformation ways. The character looks and animates fine if I use the humanoid avatar it generates when it is imported, but the avatar UMA generates with the t-pose data doesn't work correctly. Has anyone else run into this issue before? I'm just using a blend file straight out of blender.
     
  14. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Did you extract the T-Pose from your new race model and assign that Tpose Asset to your race data?
     
  15. mschwarz1

    mschwarz1

    Joined:
    Oct 22, 2013
    Posts:
    7
    Yep. Also who should I pm for a slack invite? I imagine it would be easier to have a back and forth for this.
     
  16. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Me :) or @Jaimi or @virror . I just need your email address to send the invite to.
     
  17. SecretAnorak

    SecretAnorak

    Joined:
    Mar 19, 2014
    Posts:
    177
  18. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    First of all: Thanks a lot for UMA again and also for the UMA Ragdoll stuff, this is great!

    But I have some Problems...Maybe a uma Ragdoll expert can help :)

    I made two prefabs, one for Player(s), one for Monsters or non Player characters.
    Both are made from the gameobject of the uma shooter Demo-Scene.

    The Player works good.
    In UMAPhysicsAvatar it starts OnCharacterCreatedCallback, it has 19 UMAPhysicsElements like in the shooter demo and sets the _rootbone.

    But the other Being, later in the Scene does never call OnCharacterCreatedCallback, so gets later exceptions when Ragdoll stuff is Happening because _rootbone is null.

    Why is that? I am using Uninty 2018.2.0b2 and latest UMA from github Maybe 2 weeks ago, but I guess that's not the Problem.

    Both look the same, except for the Controlling and moving script:

    Player
    upload_2018-6-22_9-58-36.png

    Being:
    upload_2018-6-22_9-59-4.png

    Both get their UMAData filled, I can see both in Scene. Both get an animator and a capsule Collider.

    Only the being does not start OnCharacterCreatedCallback…

    Thanks for some advice!


    PS: I don't know if it has something to do, but I get this error message 2 times:

    RagdollLayer and PlayerLayer are not ignoring each other! This will cause collision issues. Please update the collision matrix or 'Add Default Layers' in the Physics Slot Definition
    UnityEngine.Debug:LogWarning(Object)
    UMA.Dynamics.UMAPhysicsAvatar:Start() (at Assets/UMA/Core/StandardAssets/Extensions/UMAPhysics/UMAPhysicsAvatar.cs:94)

    Layers look like this (on the first look just like in the shooter demo):
     
  19. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
  20. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    So your "Being" object has that same UMAPhysicsElements in it's elements list? and specifically one of them is set to "isRoot"?

    You also need a "Ragdoll" layer and a "Player" layer in your collison matrix and they should be ignoring each other and the layer number in the component should correspond to the correct layer.
    https://docs.unity3d.com/Manual/LayerBasedCollision.html

    There's a one click button for this in the recipe version of this, but I'll add to our list to add that button to the component itself too.
     
  21. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hello kenamis,

    thanks a lot for your help! I added those two Layers and set them to ignore.
    Now that warning for the layers is gone.

    But it is still not working like it should.

    I duplicate the "Monster". If I shoot one, it works and I see it being "ragdolled", then it jumps into the air, just when I set ragdolled back to false. Even if it is only ragdolled for a very short time like from a Little hit, it jumps.
    But when I shoot the copy of the monster, it is "flying" on the Ground but not Looking ragdolled, very strange.

    If I create a sample I could send, would you take a look what's wrong? I could remove all stuff except uma Basics and post it public here or sent you private.
    Maybe others would like to have a look, too, it features a simple Player Controller with uma Physics, too.

    And if you find something useful you can use it for uma samples...
     
    Last edited: Jun 22, 2018
  22. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Sure
     
    Firlefanz73 likes this.
  23. Kiwi-Hawk

    Kiwi-Hawk

    Joined:
    Jul 17, 2015
    Posts:
    288
    Kia ora

    Does UMA have a discord at all? It was shugested I ask about the UMA slackers
     
  24. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    368
    Wish they did...Unity and a lot of asset publishers have come to Discord and it has been great.
     
  25. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    UMA has a slack channel. If you've never used it, it's extremely similar. PM me or Kenamis with your email address if you want an invite.
     
    Last edited: Jun 24, 2018
  26. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    BTW, I was just reading about the Addressable Asset System and how it might be a replacement or facilitator for asset bundles.

    Is this on the radar with the UMA Steering Group?
     
    Last edited: Jun 24, 2018
  27. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    We're talking about it - very interesting. Nothing definite right now, though.
     
    hopeful likes this.
  28. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hello,

    me again. :)

    For my new game with uma character I write new scripts to Dress them every single Cloth part by script.
    Before I used UMADynamicCharacter, now I want to switch to DynamicCharacterAvatar.

    I am using prefabs from the latest UMA Shooter sample with Ragdoll (thanks kenamis in getting this to work).

    But they are naked and I want to add Cloth parts in runtime.

    In older UMADynamicCharacter I had to remove legs when adding trousers first so they do not Shine through.

    I made some variations to my old script but have some Problems getting it to work with added trousers:

    Code (CSharp):
    1.     void AddClothes()
    2.     {
    3.         try
    4.         {
    5.  
    6.             UMAGeneratorBase generator;
    7.             SlotLibrary slotLibrary;
    8.             OverlayLibrary overlayLibrary;
    9.             RaceLibrary raceLibrary;
    10.  
    11.             GameObject gU = GameObject.Find("UMA_DCS");
    12.             generator = gU.GetComponentInChildren<UMAGenerator>();
    13.             slotLibrary = gU.GetComponentInChildren<SlotLibrary>();
    14.             overlayLibrary = gU.GetComponentInChildren<OverlayLibrary>();
    15.             raceLibrary = gU.GetComponentInChildren<RaceLibrary>();
    16.  
    17.             DynamicCharacterAvatar dynamicAvatar = gameObject.GetComponent<DynamicCharacterAvatar>();
    18.  
    19.             //can I use umadata which is already there ?
    20.             UMAData umaData = dynamicAvatar.umaData;
    21.  
    22.             ////or need to initialize naked man in order to add clothes?
    23.             //dynamicAvatar.Initialize();
    24.             //dynamicAvatar.umaRecipe = BaseReceipe;
    25.             //UMAData umaData = dynamicAvatar.umaData;
    26.             //// Attach our generator
    27.             //dynamicAvatar.umaGenerator = generator;
    28.             //dynamicAvatar.ChangeRace(BaseRace); //needed?
    29.             //umaData.umaGenerator = generator;
    30.             //// Setup slot array
    31.             //umaData.umaRecipe.slotDataList = new SlotData[20];
    32.             //// Setup morph references
    33.             //UMADna umaDna = new UMADnaHumanoid();
    34.             //umaData.umaRecipe.AddDna(umaDna);
    35.  
    36.             // Colors needed?
    37.             //umaData.umaRecipe.sharedColors = new OverlayColorData[1];
    38.  
    39.             // Dress
    40.             string trousersSlot = "M_Ranger Lower";
    41.             string trousersOverlay = "Lower Ranger";//Ranger Leg Armor
    42.  
    43.             umaData.umaRecipe.slotDataList = new SlotData[20];//numberOfSlots
    44.             if (umaData.umaRecipe.slotDataList[10] != null)
    45.                 umaData.umaRecipe.slotDataList[10].RemoveOverlay();
    46.             umaData.umaRecipe.slotDataList[10] = null;
    47.             if (umaData.umaRecipe.slotDataList[5] != null)
    48.                 umaData.umaRecipe.slotDataList[5].RemoveOverlay();
    49.             umaData.umaRecipe.slotDataList[10] = slotLibrary.InstantiateSlot(trousersSlot);
    50.             //umaData.umaRecipe.slotDataList[10].AddOverlay(overlayLibrary.InstantiateOverlay(trousersOverlay, Color.black));
    51.             umaData.umaRecipe.slotDataList[10].AddOverlay(overlayLibrary.InstantiateOverlay(trousersOverlay));
    52.  
    53.             dynamicAvatar.UpdateNewRace();
    54.             umaData.Dirty(true, true, true);
    55.         }
    56.         catch (UnityException ex)
    57.         {
    58.             UnityEngine.Debug.LogWarning("UMAMaker Init Error: " + ex.ToString());
    59.         }
    60.     }
    When I try to add it this way, it says (errolog):

    UMA recipe missing required race!
    UnityEngine.Debug:LogError(Object)
    UMA.UMARecipe:Validate() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAData.cs:369)
    UMA.UMAData:Validate() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAData.cs:221)
    UMA.UMAGeneratorBuiltin:HandleDirtyUpdate(UMAData) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:189)
    UMA.UMAGeneratorBuiltin:OnDirtyUpdate() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:259)
    UMA.UMAGeneratorBuiltin:Work() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:132)
    UMA.UMAGeneratorBuiltin:Update() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:97)

    UMAData: Recipe or Generator is not valid!
    UnityEngine.Debug:LogError(Object)
    UMA.UMAData:Validate() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAData.cs:233)
    UMA.UMAGeneratorBuiltin:HandleDirtyUpdate(UMAData) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:189)
    UMA.UMAGeneratorBuiltin:OnDirtyUpdate() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:259)
    UMA.UMAGeneratorBuiltin:Work() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:132)
    UMA.UMAGeneratorBuiltin:Update() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:97)



    If I try to add new umadata (is this neccessary?) like in the block which is disabled in the above Code,
    I get this errorlog:

    NullReferenceException: Object reference not set to an instance of an object
    UMA.CharacterSystem.DynamicCharacterAvatar.EnsureSharedColors () (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:1410)
    UMA.CharacterSystem.DynamicCharacterAvatar.GetCurrentRecipe (System.Boolean backwardsCompatible) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:1824)
    UMA.CharacterSystem.DynamicCharacterAvatar.AddCharacterStateCache (System.String cacheStateName) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:3015)
    UMA.CharacterSystem.DynamicCharacterAvatar.PerformRaceChange (UMA.RaceData race, UMA.CharacterSystem.DynamicCharacterAvatar+ChangeRaceOptions customChangeRaceOptions) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:646)
    UMA.CharacterSystem.DynamicCharacterAvatar.ChangeRace (UMA.RaceData race, UMA.CharacterSystem.DynamicCharacterAvatar+ChangeRaceOptions customChangeRaceOptions) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:615)
    RigidbodyCharacter.AddClothes () (at Assets/Scripts/RigidbodyCharacter.cs:126)
    RigidbodyCharacter.InitAnimations () (at Assets/Scripts/RigidbodyCharacter.cs:96)
    RigidbodyCharacter.Update () (at Assets/Scripts/RigidbodyCharacter.cs:181)

    it is in void EnsureSharedColors()

    When I start the game with a naked uma char and then add a Slot and overlay in the inscpector in umadata, it works perfect and I can see the clothes…

    Thanks a lot! I want to have unique People wearing mixed stuff I can set via script, that would be great :)

    Have a nice Sunday!

    PS: turning off dynamicAvatar.UpdateNewRace(); does not help, again I get the error UMA recipe missing required race!
     
    Last edited: Jun 24, 2018
  29. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    When using DynamicCharacterAvatar, this is all data driven.

    Simply make a Wardrobe Recipe, add your pants slot and overlay to it, and setup the race. Then tell the recipe that it hides the base slot legs.

    Also, note that you can also use the Global Library, so you don't have to put things in OverlayLibraries, Slot Librarys and Race Libraries, and then propagate those from scene to scene.

    Here's an example function that randomizes everything on a DCA:

    Code (CSharp):
    1.      
    2. private void Randomize(DynamicCharacterAvatar Avatar)
    3.         {
    4.             Dictionary<string, List<UMATextRecipe>> recipes = Avatar.AvailableRecipes;
    5.             // Set random wardrobe slots.
    6.             foreach (string SlotName in recipes.Keys)
    7.             {
    8.                 int cnt = recipes[SlotName].Count;
    9.                 if (cnt > 0)
    10.                 {
    11.                     //Get a random recipe from the slot, and apply it
    12.                     int rnd = Random.Range(0, cnt);
    13.                     Avatar.SetSlot(recipes[SlotName][rnd]);
    14.                 }
    15.             }
    16.      }

    This gets the recipes that are applicable to the currently selected race on the avatar, and loops through the wardrobe slots, and sets a random wardrobe recipe. All of the mechanics of hiding the legs, and removing any previous clothing for that slot are handled internally. It's definitely the easiest way to do it.



     
  30. KospY

    KospY

    Joined:
    May 12, 2014
    Posts:
    153
    Hello there!

    What is the best method for adding blood splatters on UMA characters? I need to be able to apply blood decals precisely on body (not just overlaying the whole body with a blood mask).
    I tried a lot of asset on the store and so far I didn't find anything working correctly for UMA.
    Does anybody accomplished that?
     
  31. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Blood splatters (etc) are difficult because they need their own UV coordinates, so these would have to be handled outside the UMA process.

    Maybe someone will have a better answer, but from my initial thoughts, I think you would have to track these somehow on your character, and then hook into one of the events to generate and apply them as decals after UMA generation.



     
  32. Bantichai

    Bantichai

    Joined:
    Nov 6, 2016
    Posts:
    138
    Hey guys, does anyone know what these errors are? I always get these 3 errors together whenever importing an UMA costume. The full length of the message is shown in this one picture.

    UMA Issues.jpg
     
  33. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    I'll take a look at it. Do you have a specific uma pack that you know it always happens on? and what versions of unity?
     
  34. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I've hit an interesting problem with my implementation and UMA skeleton building, but probably not unique one.

    Long story short: I'm attaching instantiated weapons to the bone skeleton hierarchy, and UMA considers them as a part of the bone structure on initialization as well. Which leads to the UMA intialization errors.

    This wasn't a problem before, because I didn't used save/loading, and new game didn't had any player weapons attached. But now when I load, weapons get attached earlier than UMA initialization happens, leading to the issue above.

    I wonder is there a non-hacky way to prevent it from doing so?
    I'm thinking about writing something custom that tells UMASkeleton:AddBonesRecursive to do not touch any bones beneath found component X, or tag.
    Maybe this already included in a package?

    I haven't upgraded in a while, due to some custom features.
     
    Last edited: Jun 28, 2018
  35. SecretAnorak

    SecretAnorak

    Joined:
    Mar 19, 2014
    Posts:
    177
    Are you adding bones with non-unique names?

    UMA expects every bone to be uniquely named so if you have a bone called "WeaponAttachment" on each hand you will get errors on initialization as it can't decide which is which.
     
  36. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Yes, they're pretty much prefabs, cloned to both hands attached to the hierarchy. Names are equal on both hands, causing issues.

    Edit: It looks like this:
    Hand -> WeaponSlot (This one is unique for each hand) -> Weapon (Clone) <- this one isn't
     
  37. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    In reality I don't want to add them as bones. Check my edits above.
     
  38. SecretAnorak

    SecretAnorak

    Joined:
    Mar 19, 2014
    Posts:
    177
    The easiest way is to add uniquely named attachment points as bones, Then at runtime simply instantiate whichever weapon you need and parent it to the appropriate attachment point. When making your weapon prefabs, you can parent your weapon models to dummy objects to account for any offsetting and rotating you might need.
     
    hopeful likes this.
  39. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I think I've understand why that happens.
    I've got hand poser script to adjust my IK, on the weapon, and the weapon itself got hierarchy for fingers, bones of which are identical to the ones that are in the skeleton.

    Now I do need a way to prevent UMA going down hierarchy at certain point.
    I've managed hack together an interface, attach that to script, and perform a check, like so:

    Code (CSharp):
    1. private void AddBonesRecursive(Transform transform)
    2.         {
    3.             var hash = UMAUtils.StringToHash(transform.name);
    4.             var parentHash = transform.parent != null ? UMAUtils.StringToHash(transform.parent.name) : 0;
    5.             BoneData data = new BoneData()
    6.             {
    7.                 parentBoneNameHash = parentHash,
    8.                 boneNameHash = hash,
    9.                 accessedFrame = frame,
    10.                 boneTransform = transform,
    11.                 umaTransform = new UMATransform(transform, hash, parentHash)
    12.             };
    13.  
    14.             if (!boneHashData.ContainsKey(hash))
    15.             {
    16.                 boneHashData.Add(hash, data);
    17. #if UNITY_EDITOR
    18.                 boneHashDataBackup.Add(data);
    19. #endif
    20.             }
    21.             else
    22.                 Debug.LogError("AddBonesRecursive: " + transform.name + " already exists in the dictionary!");
    23.  
    24.             for (int i = 0; i < transform.childCount; i++)
    25.             {
    26.                 var child = transform.GetChild(i);
    27.                
    28.                 // Add bone only if it doesn't contain instantiated data
    29.                 if (child.GetComponent<IUMABoneIgnore>() == null) {
    30.                     AddBonesRecursive(child);
    31.                 }
    32.             }
    33.         }
    But I'm still getting following:
    Does UMA also performs a check somewhere else?
     
  40. SecretAnorak

    SecretAnorak

    Joined:
    Mar 19, 2014
    Posts:
    177
    That's beyond me I'm afraid, I'm more of a "model butcher" than a programmer. I'd just strip off the excess bones and work with a clean weapon model. I'm sure one of the wiser UMA people will be able to help.
     
  41. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Ok, not problem, I was just looking a shortcut, I'll figure that out eventually.
     
  42. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I've made a hack. Actually error was caused by Unity's AvatarBuilder, for the same reason - it got confused by multiple same named bones.

    What I did was - create an interface that determines what bones and downwards should be ignored. In addition to .AddBoneRecursive I did the following:

    In UMAGeneratorBase:
    Code (CSharp):
    1.         private static readonly List<TransformData> _transformData = new List<TransformData>();
    2.         private static readonly List<IUMABoneIgnore> _boneIgnoreList = new List<IUMABoneIgnore>();
    3.  
    4.         private struct TransformData {
    5.             public Transform Transform;
    6.             public Transform PreviousParent;
    7.         }
    8.    
    9.         /// <summary>
    10.         /// Creates a human (biped) avatar for a UMA character.
    11.         /// </summary>
    12.         /// <returns>The human avatar.</returns>
    13.         /// <param name="umaData">UMA data.</param>
    14.         /// <param name="umaTPose">UMA TPose.</param>
    15.         public static Avatar CreateAvatar(UMAData umaData, UmaTPose umaTPose)
    16.         {
    17.             umaTPose.DeSerialize();
    18.             HumanDescription description = CreateHumanDescription(umaData, umaTPose);
    19.        
    20.             DetachIgnoredBones(umaData.transform);
    21.             //DebugLogHumanAvatar(umaData.gameObject, description);
    22.             Avatar res = AvatarBuilder.BuildHumanAvatar(umaData.gameObject, description);
    23.             AttachIgnoredBones();
    24.        
    25.             res.name = umaData.name;
    26.             return res;
    27.         }
    28.  
    29.         /// <summary>
    30.         /// Gathers information about ignored bones, and de-attaches them from the rig
    31.         /// </summary>
    32.         private static void DetachIgnoredBones(Transform umaTransform) {
    33.             _transformData.Clear();
    34.             _boneIgnoreList.Clear();
    35.  
    36.             umaTransform.GetComponentsInChildren(_boneIgnoreList);
    37.  
    38.             foreach (IUMABoneIgnore ignore in _boneIgnoreList) {
    39.                 Transform ignoredTrm = ignore.transform;
    40.                 _transformData.Add(new TransformData {
    41.                                                          Transform = ignoredTrm,
    42.                                                          PreviousParent = ignoredTrm.parent
    43.                                                      });
    44.  
    45.                 ignoredTrm.parent = null;
    46.             }
    47.         }
    48.  
    49.         /// <summary>
    50.         /// Re-Attaches back ignored bones
    51.         /// </summary>
    52.         private static void AttachIgnoredBones() {
    53.             foreach (TransformData data in _transformData) {
    54.                 data.Transform.parent = data.PreviousParent;
    55.             }
    56.         }
    Interface:
    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. namespace Contracts {
    4.    public interface IUMABoneIgnore {
    5.       // ReSharper disable once InconsistentNaming -> Unity naming
    6.       Transform transform { get; }
    7.    }
    8. }
    9.  
    My bone / weapon parent.
    Code (CSharp):
    1. public class WeaponSlot : MonoBehaviour, ..., IUMABoneIgnore {
    2.       ....
    3. }
    So, when the avatar is build - bones that are ignored are pre-emptively removed from the hierarchy, and afterwards re-parent back. Brute-force solution, but it seems to be working.
     
    Last edited: Jun 28, 2018
  43. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    So make it unique? You can change the name in script after you instantiate it, then you don't have to deal with any of this workaround.
     
    hopeful likes this.
  44. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    You haven't read the whole thing, right?
    I'm using IK proxy hand poser, which contains hand bone hierarchy under weapon root.

    Even if I make it unique, I would either need to rewrite IK hand poser script to work with altered hand bone rig, and change names of gameobjects when designing new weapons. Due to them just being copy + pasted from the rig, and adjusted afterwards.

    Not to mention I would need to alter hand bone structure on already created weapons.

    This is really much more troublesome than just detaching slot one time.
    Sure I can alter entire workflow, but like, are you serious?

    Also, I'm pretty happy on how it works now. I don't think everything attached to the hierarchy should be built to the rig / avatar automatically. At least I've got a way to exclude child objects.
     
    Last edited: Jun 28, 2018
  45. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Yes, I have.
    You're not really clear about how this works. If they are prefabs that you are instantiating at runtime then it should be fairly easy to have a "prefix" string variable to add to the start of your bone names and for any relative searches. Also/instead, I believe prefabs can reference other objects within the prefab, so you can link all your transforms needed for the IK script in the editor, have a function to prefix all the gameobjects name in the prefab when instantiated and all the references will still be there for you.
    It's unclear why you need a hand bone structure on your weapon. Is there a reason why?
    This makes me think you're having weapons as slots and part of the UMA, is that the case? If so, that's what's confusing and does change a lot of the responses above.
    I don't think it alters your entire workflow.
    Maybe you didn't intend, but this comment and your first comment come off as antagonstic. Why? I'm trying to help you...

    If this was your initial issue, then there is an event "CharacterCreated" or "CharacterUpdated" that you can use to add your weapon after the UMA is finished generating.
     
    xVergilx, TeagansDad and hopeful like this.
  46. Bantichai

    Bantichai

    Joined:
    Nov 6, 2016
    Posts:
    138
    Thanks @kenamis that actually did the trick, just tested it on the latest Unity and it works without errors, I was still working with 2017.1.1!
     
    kenamis likes this.
  47. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Weapons contain hierarchy that transforms fingers local positions / local rotations to fit more closely to the gun, rather than having fingers flopping around or doing nothing.

    It's not "default" IK, it's on top of it.

    It has nothing to do with the stuff you described above.

    More like "finger IK". It's custom solution, closest of the fits would be FinalIK Hand Poser.

    Also, I'm attaching multiple weapons at once, "pre-caching" them, as player sets them to hotkeys in their inventories.

    Now imagine, I would have to add 10 weapons, or 20 to be precise (at max).
    Because in my game you can actually use two different weapons at once.

    All those weapons would require unique naming.
    All bones attached to them would require a unique naming.
    Their permutations would require also to be unique.
    Scripts that perform hand -> hand proxy remap should be aware of those, and somehow know what's what.
    They are based on bone names.

    It would be a mess.

    I could subscribe to the event, and wait for UMA to build a character, then wait untill my prefabs are instantiated, but why?

    Game doesn't need to wait for that stuff. It shouldn't need to be.
    Those systems shouldn't be confronting each other in any case.

    It's a design oversight, from my perspective. Not being able to set in stone what is rig, and what isn't.

    Ideal solution would be just to allow designers to define what are bones, and what's not in the hierarchy.
    That way UMA won't need to recursively search for bones.

    But at the same time it would still require to detach bones, since AvatarBuilder.BuildHumanAvatar has only gameObject as parameter.

    In any case, I've found the solution that works for me. I'm not going to create any more offtopic.

    I know you're trying to help, but it's a bit more complicated than just simply "make it unique".
     
    Last edited: Jun 29, 2018
  48. Seifu_

    Seifu_

    Joined:
    Jun 11, 2015
    Posts:
    5
    New Video a couple posts down.
     
    Last edited: Jul 2, 2018
    ecurtz and kenamis like this.
  49. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Nice! You didn't show off any networked dna changes or clothing change :p
     
  50. Seifu_

    Seifu_

    Joined:
    Jun 11, 2015
    Posts:
    5
    true, i'll make a better one. The hair and size is different for those guys though which loaded/replicated over the network. Hows this one?

    Special Thanks to
    SecretAnorak for teaching me how to use uma btw!
    UMA + Photon Bolt + Unity 2018.2.
     
    Last edited: Jul 2, 2018
    Jschilz1 and hopeful like this.