Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

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

  1. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I'd assumed they were shared because they were static. You might want to put your initialization code on a separate script, and hook it into the OnCharacterCreated event (or Updated, depending on what you need).
     
  2. Zebra-Sin

    Zebra-Sin

    Joined:
    Feb 9, 2014
    Posts:
    22
    First, thanks for the reply.

    I'm searching how to replace textures on the fly, and I don't want to save the modificatiions in the sources assets.

    What i'm doing here, after your help :
    Code (CSharp):
    1.         UMAWardrobeRecipe uMAWardrobeRecipe = (UMAWardrobeRecipe)ScriptableObject.CreateInstance(typeof(UMAWardrobeRecipe));
    2.         uMAWardrobeRecipe.SetBytes(UMACharacter.WardrobeRecipes["Legs"].GetBytes());
    3.         SlotData slotDataNewJean = uMAWardrobeRecipe.GetUMARecipe().GetSlot(0).Copy();
    4.         OverlayData overlayDataNewJean = slotDataNewJean.GetOverlay(new string[] { "Jean_Overlay" }).Duplicate();
    5.         overlayDataNewJean.textureArray[0] = newMatJean.mainTexture;
    6.         slotDataNewJean.SetOverlay(0, overlayDataNewJean);
    7.         uMAWardrobeRecipe.GetUMARecipe().SetSlot(0, slotDataNewJean);
    8.  
    9.         UMACharacter.WardrobeRecipes.Remove("Legs");
    10.         UMACharacter.WardrobeRecipes.Add("Legs", (UMATextRecipe)uMAWardrobeRecipe);
    11.  
    12.         UMACharacter.ForceUpdate(false, true, false);
    13.  
    This code change the texture on the pant, no problem with that, but the modifications are saved in the editor while the code is executing only in play mode.
    How to achieve this ? I can't find the little option to no save the modifications on the assets sources. UMA do this by default, and, in my case, it's relatively bad design (but I understood why uma do this).

    Any help plz ?
     
  3. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    Yes, I'm aware of that. Sorry for not being more clear. I mean facial movements. None of us holds their face muscles perfectly still, there's always a bit of twitching here, small movements there. I just want to bring faces to life - not just eyes.
     
  4. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    Can you people please post links to the game you are making that uses UMA?

    Can you state which platform its using (PC, Android,IOS etc)
     
  5. daveinpublic

    daveinpublic

    Joined:
    May 24, 2013
    Posts:
    167
    Problem updating my UMA install.... from 2.9 to 2.10.

    I'm using Unity 2019.4.9f1.
    I go to Package Manager, then UMA 2, update, import.

    When I hit import, I get these small yellow warning signs, they say:
    "Warning: File exists in project, but with different GUID. Will override existing asset which may be undesired."

    I get the warning sings (as seen below) on: UMA_Core, HumanFemale, FBX, HumanMale, FBX.

    And if I go through with it, lots of stuff messes up. Big time.

    Am I doing something wrong? I need to update to the latest version of UMA, especially since it has a feature that can get my UMA characters working in the Universal Render Pipeline, which I need.



    EDIT: Here are some of the errors I get after installing over UMA 2.9:

    GUID [e91f0c554acd0ae47840334fddb2602d] for asset 'Assets/UMA/Content/Contrib' conflicts with:
    'Assets/UMA/Content/UMA_Contrib' (current owner)
    Assigning a new guid.
    // Note: There's 2 more GUID errors like this.

    Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAContext.cs(10,15): error CS0260: Missing partial modifier on declaration of type 'UMAContext'; another partial declaration of this type exists

    Assets/UMA/Core/StandardAssets/Extensions/DynamicCharacterSystem/Scripts/pUMAContext.cs(9,23): error CS0263: Partial declarations of 'UMAContext' must not specify different base classes

    Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAContext.cs(28,24): error CS0115: 'UMAContext.Start()': no suitable method found to override

    Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAContext.cs(51,24): error CS0115: 'UMAContext.ValidateDictionaries()': no suitable method found to override

    Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAContext.cs(68,28): error CS0115: 'UMAContext.HasRace(string)': no suitable method found to override
     
    Last edited: Oct 1, 2020
  6. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Can you give me more information on what you are trying to do?
     
  7. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    It's best to remove the old UMA folder, and import the new folder. Sometimes the system can get confused as to what is new, and what is not.

     
  8. Zebra-Sin

    Zebra-Sin

    Joined:
    Feb 9, 2014
    Posts:
    22
    I need to replace the texture, on the fly / on the go (I don't know say that in english), on an item of the wardrobe or on the skin of an uma character.
    If I build my testing project, the changed textures are not saved, this is good.
    I'm trying to accomplish the same thing in Play Mode to avoid time lost on builds. I need to test in Play Mode, without UMA save the changes.
    If I create a new reference with the same material, uma lost the reference to the material, and the uma material has lost hist unity material property.

    I'm doing this way do copy the material :
    Code (CSharp):
    1. overlayDataNewJean.asset.material.material = new Material(overlayDataNewJean.asset.material.material);
    So, my final goal is just how to avoid uma to save my material changes ? If I uncheck all checkbox realted to auto-saving the assets, uma recheck automatically theses checkboxes, even if I set the property related to false in C# code.

    There is a problem with my methodology or I misunderstood uma ? It's maybe a unity problem ? I don't know, I tried different things in code today, but all my techniques failed somewhere.
     
    Last edited: Oct 1, 2020
  9. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Are you modifying the texture to add decals or blood effects or something?

    Anyway, you can get the renderers, and get their shared materials, and update those. Or, The slot has a callback when it is atlassed, and you can get the material, and the area on the atlas, in the callback.
     
  10. Zebra-Sin

    Zebra-Sin

    Joined:
    Feb 9, 2014
    Posts:
    22
    No, I want to have different textures based on same mesh and uv mapping, using UMA. This is basics and native in Unity. I don't want to define multiples overlays at hand, if I can do it programmaticaly.
    Just, how to force UMA to not save the updates while i'm in play mode ?

    I'll watch on renderer stuff, but I'm not sure it's the right place to do what I want.
     
  11. mohit-mittal914

    mohit-mittal914

    Joined:
    Sep 1, 2017
    Posts:
    2
    Hey, Can you tell me what exactly you did? I am stuck with something similar. I am trying to access Skeleton from umaData, but getting NullReferenceError.
     
  12. girlinorbit

    girlinorbit

    Joined:
    Apr 27, 2019
    Posts:
    115
    I've checked all those and the problem still persists. I'm at a bit of a loss right now.
     
  13. mohit-mittal914

    mohit-mittal914

    Joined:
    Sep 1, 2017
    Posts:
    2
    Hi,
    I am trying to attach weapon to my player's hand. I am using Unity v2019.4.0f1 and UMA v2.10

    I have created a Player game object and attached "Dynamic Character Avatar" and "UMA Dynamic Avatar" components to the game object to create the avatar.


    In the script I am getting UMADynamic Avatar in awake method.
    playerAvatar = GetComponent<UMADynamicAvatar>();

    In start method:
    if (playerAvatar != null)
    {
    Debug.Log("Found UMA Character" + playerAvatar.ToString());
    playerUMAData = playerAvatar.umaData;
    if (playerUMAData != null)
    {
    Debug.Log("Found UMAData " + playerUMAData.ToString());
    Debug.Log("Bone Hash = " + UMAUtils.StringToHash("RightHand"));
    playerHand = playerUMAData.GetSkeleton().GetBoneGameObject(UMAUtils.StringToHash("RightHand"));
    if (playerHand != null)
    {
    Debug.Log("Found Right Hand " + playerHand.name);
    transform.SetParent(playerHand.transform);
    }
    }
    }


    __________________

    Then I select the player game object and from UMA menu, I selected Bone Builder and Generated Bones.
    _________________

    When I play the scene, I am getting NullReferenceException at line
    playerHand = playerUMAData.GetSkeleton().GetBoneGameObject(UMAUtils.StringToHash("RightHand"));

    All lines above this line is printing the debug messages.

    Please help!
    Why am I not able to get the Right hand from the UMAData.

    Thanks in advance.
     
  14. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    If you're set on updating the texture on the overlay, just remember that the overlay can be in use by other characters as well, so you're changing it for everyone.
     
  15. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Sorry - there isn't anything else that I'm aware of. But the Expression Player is animatable, so you could layer animations for that on top to do that.
     
  16. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I answered this on the discord, but in case anyone searches this - the code was being called before the UMA was initialized. Because the bone builder had been used, the bone could be assigned to the script manually.
     
    hopeful likes this.
  17. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Ok - the only other thing I can think of is the UV coordinates are out of the 0..1 range. The SlotBuilder window has a "verify" option that will check this.
    If your UV coordinates are outside the window, it will look correct in Blender (or Maya), but when it is atlassed, the UV coordinates will be in the wrong location.

    In Blender - you can go into the UV window, and see if the texture is over the bitmap. If not, then the texture is outside standard 0..1 coordinates. Some unwrapping utilities do this.

    uvlayout.png
     
  18. Zebra-Sin

    Zebra-Sin

    Joined:
    Feb 9, 2014
    Posts:
    22
    This is why I create a new instanciated overlay, by code.

    Here my whole code, who not works (material / texture not updated), and where I recreate all the basics UMA for overlay from scratch. Maybe I miss something.
    Code (CSharp):
    1.  
    2. using System;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5. using System.Security.Policy;
    6. using UMA;
    7. using UMA.CharacterSystem;
    8. using UnityEngine;
    9. using UnityEngine.UI;
    10.  
    11. public class TetstSriptChangeTexturesBis : MonoBehaviour
    12. {
    13.   void Update()
    14.   {
    15.     if (Input.GetKeyDown(KeyCode.Space))
    16.     {
    17.       try
    18.       {
    19.         //SlotData slotDataJean = UMACharacter.GetWardrobeItem("Legs").GetUMARecipe().GetSlot(0).Copy();
    20.         //SlotData sdJean = UMACharacter.WardrobeRecipes["Legs"].GetUMARecipe().GetSlot(0).Copy();
    21.  
    22.         UMAWardrobeRecipe newUMAWardrobeRecipe = (UMAWardrobeRecipe)ScriptableObject.CreateInstance(typeof(UMAWardrobeRecipe));
    23.         newUMAWardrobeRecipe.SetBytes(UMACharacter.WardrobeRecipes["Legs"].GetBytes());
    24.         newUMAWardrobeRecipe.compatibleRaces.Add("TEST RACE");
    25.         //newUMAWardrobeRecipe.name += "Legs (1)";
    26.  
    27.         SlotData slotDataNewJean = newUMAWardrobeRecipe.GetUMARecipe().GetSlot(0).Copy();
    28.         //SlotData slotDataNewJean = UMACharacter.WardrobeRecipes["Legs"].GetUMARecipe().GetSlot(0).Copy();
    29.  
    30.         #region Get Overlay Number
    31.         int overlayNumber = -1;
    32.  
    33.         List<OverlayData> ovList = slotDataNewJean.GetOverlayList();
    34.         for (int i = 0; i < ovList.Count; i++)
    35.           if (ovList[i].overlayName == "Jean_Overlay")
    36.           {
    37.             overlayNumber = i;
    38.             break;
    39.           }
    40.  
    41.         if (overlayNumber < 0)
    42.           Debug.LogError("Overlay Number not found");
    43.  
    44.         //Debug.Log("Overlay number is : " + overlayNumber.ToString());
    45.         #endregion
    46.  
    47.         //OverlayData newJeanOverlayData = slotDataNewJean.GetOverlay(overlayNumber).Duplicate();
    48.  
    49.         OverlayDataAsset newJeanOverlayDataAsset = (OverlayDataAsset)ScriptableObject.CreateInstance(typeof(OverlayDataAsset));
    50.         newJeanOverlayDataAsset.overlayName = "Jean_Overlay (1)";
    51.         newJeanOverlayDataAsset.nameHash = UMAUtils.StringToHash(newJeanOverlayDataAsset.overlayName);
    52.         newJeanOverlayDataAsset.rect = new Rect();
    53.  
    54.  
    55.         UMAMaterial newJeanUMAMaterial = (UMAMaterial)ScriptableObject.CreateInstance(typeof(UMAMaterial));
    56.         newJeanUMAMaterial.name += "Jean_UMA_Material_(1)";
    57.         newJeanUMAMaterial.material = new Material(newMatJean.shader);
    58.         //newJeanUMAMaterial.material = newMatJean;
    59.         newJeanUMAMaterial.material.mainTexture = Texture.Instantiate(newMatJean.mainTexture);
    60.         newJeanUMAMaterial.channels = new UMAMaterial.MaterialChannel[1];
    61.         newJeanUMAMaterial.channels[0] = new UMAMaterial.MaterialChannel();
    62.         newJeanUMAMaterial.channels[0].channelType = UMAMaterial.ChannelType.Texture;
    63.         newJeanUMAMaterial.channels[0].materialPropertyName = "_MainTex";
    64.  
    65.         newJeanOverlayDataAsset.material = newJeanUMAMaterial;
    66.  
    67.         newJeanOverlayDataAsset.textureList = new Texture[1];
    68.         newJeanOverlayDataAsset.textureList[0] = Texture.Instantiate(newMatJean.mainTexture);
    69.      
    70.         OverlayData newJeanOverlayData = new OverlayData(newJeanOverlayDataAsset);
    71.         newJeanOverlayData.colorData = new OverlayColorData(1);
    72.         newJeanOverlayData.colorData.SetChannels(1);
    73.      
    74.         #region Comment
    75.         //  THIS RETURN TRUE
    76.         //Debug.Log(newJeanOverlayData.Validate(newJeanUMAMaterial, true).ToString());
    77.  
    78.         //overlayDataJeanNew.textureArray[0] = newMatJean.mainTexture;
    79.         #endregion
    80.  
    81.         newJeanOverlayData.textureArray[0] = Texture.Instantiate(newMatJean.mainTexture);
    82.         newJeanOverlayData.EnsureChannels(1);
    83.  
    84.         //slotDataNewJean.SetOverlay(overlayNumber, overlayDataJeanNew);
    85.         //slotDataJean.SetOverlay(overlayNumber, newJeanOverlayData);
    86.         slotDataNewJean.SetOverlay(overlayNumber, newJeanOverlayData);
    87.  
    88.         newUMAWardrobeRecipe.GetUMARecipe().SetSlot(0, slotDataNewJean);
    89.  
    90.         UMACharacter.WardrobeRecipes.Remove("Legs");
    91.         UMACharacter.WardrobeRecipes.Add("Legs", newUMAWardrobeRecipe);
    92.  
    93.         UMACharacter.ForceUpdate(true, true, true);
    94.       }
    95.       catch (Exception e)
    96.       {
    97.         Debug.LogException(e);
    98.       }
    99.     }
    100.   }
    101. }
    102.  
    If I do this, I theorically recreate from scratch all a the data needed to change the overlay "properly", so the texture is theorically change only on the object I want to.
    But, this code don't works, there is no error in execution (play mode, no test in a build). The texture is not changed in the scene. If I don't create the UMAMaterial manually, it works but changed are save on the assets sources, and that I don't want to.

    Just tell me if I'm doing wrong, because I tested practically everithing in code all the day, and can't find a solution.

    Why UMA save me changes automatically in the sources assets and don't reuse the cache after Play Mode terminated, like Unity does ? I need to deactivate this feature. Like I said previously, if I build the project, everthing works and textures changed made are not saved. I just need same feature in Play Mode.
     
    Last edited: Oct 2, 2020
  19. daveinpublic

    daveinpublic

    Joined:
    May 24, 2013
    Posts:
    167
    I upgraded from UMA 2.9 to 2.10, and everything is almost perfect.

    I only have 2 problems.

    The animation controller on a few of my UMA controllers is automatically changing each time I press play. I have a controller, let's say it's called 'My Controller', and every time I hit play, several players automatically change to a controller called 'Locomotion with Head'. And the funny part is, across 15 characters, it's only doing it to the male characters.

    The 2nd problem is the hair material. 'UMA_Mesh_Hair_DoubleSided' was originally an UMA material, but was one of the only materials that wasn't converted. I chose 'URP/Lit' and the hair isn't automatically updated anymore.

    Thank you guys,
    David

    Edit: I should say the hair isn't updated per player anymore, instead the color is the same across all the characters. But, I did find another material that seems to work pretty for the hair that updates, called URP/Nature/SpeedTree8.
     
    Last edited: Oct 2, 2020
  20. Zebra-Sin

    Zebra-Sin

    Joined:
    Feb 9, 2014
    Posts:
    22

    Okay, Il found a solution to undoing the changes the overlay data asset on playing mode, but I think this is a UMA bug related, because if I create the overlay data asset from scratch, the character is not updated (but parameters are valid and goods).

    Here is my code to solve my problem (ak: cancel uma changes on a texture change in play mode, changes are not saved in build, that last one was good) :
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UMA;
    5. using UMA.CharacterSystem;
    6. using JetBrains.Annotations;
    7. using System.Data;
    8. using UnityEditor;
    9. using System.Reflection;
    10. using System;
    11.  
    12. public class TestScriptChangeTextureQuarto : MonoBehaviour
    13. {
    14.   public DynamicCharacterAvatar UMACharacter;
    15.   public Material newMatJean;
    16.  
    17.   private UMAMaterial umaMaterialOrig;
    18.   private Texture[] texturesOrig;
    19.  
    20.   public OverlayDataAsset ODA_Jean_Source;
    21.  
    22.   void OnEnable()
    23.   {
    24.     umaMaterialOrig = ODA_Jean_Source.material;
    25.     texturesOrig = ODA_Jean_Source.textureList;
    26.   }
    27.  
    28.   void Update()
    29.   {
    30.     if (!Input.GetKeyDown(KeyCode.Space))
    31.       return;
    32.  
    33.     UMAWardrobeRecipe uMAWardrobeRecipe = (UMAWardrobeRecipe)ScriptableObject.CreateInstance(typeof(UMAWardrobeRecipe));
    34.     uMAWardrobeRecipe.SetBytes(UMACharacter.WardrobeRecipes["Legs"].GetBytes());
    35.  
    36.     #region Get Slot Jean && Overlay Jean Indexes
    37.     int slotIndex = -1;
    38.     int overlayIndex = -1;
    39.  
    40.     SlotData[] slotDataArray = uMAWardrobeRecipe.GetUMARecipe().GetAllSlots();
    41.     for (int i = 0; i < slotDataArray.Length; i++)
    42.       if (slotDataArray[i] != null && slotDataArray[i].slotName == "Jean")
    43.       {
    44.         slotIndex = i;
    45.         break;
    46.       }
    47.  
    48.     if (slotIndex < 0)
    49.       for (int i = 0; i < slotDataArray.Length; i++)
    50.         if (slotDataArray[i] != null)
    51.         {
    52.           slotIndex = i;
    53.           Debug.LogWarning("Slot index is #" + i.ToString() + ", selected first non null value");
    54.           break;
    55.         }
    56.  
    57.  
    58.     if (slotIndex < 0)
    59.       Debug.LogError("Slot index not found");
    60.  
    61.  
    62.     List<OverlayData> overlayDataList = uMAWardrobeRecipe.GetUMARecipe().GetSlot(slotIndex).GetOverlayList();
    63.  
    64.     for (int i = 0; i < overlayDataList.Count; i++)
    65.       if (overlayDataList[i] != null && overlayDataList[i].overlayName == "Jean_Overlay")
    66.       {
    67.         overlayIndex = i;
    68.         break;
    69.       }
    70.  
    71.     if (overlayIndex < 0)
    72.       for (int i = 0; i < overlayDataList.Count; i++)
    73.         if (overlayDataList[i] != null)
    74.         {
    75.           overlayIndex = i;
    76.           Debug.LogWarning("Overlay index is #" + overlayIndex.ToString() + ", selected first non null value");
    77.         }
    78.  
    79.     if (overlayIndex < 0)
    80.       Debug.LogError("Overlay index not found");
    81.     #endregion
    82.  
    83.     OverlayDataAsset overlayDataAssetNewJean = UMACharacter.WardrobeRecipes["Legs"].GetUMARecipe().GetSlot(slotIndex).GetOverlay(overlayIndex).asset;
    84.  
    85.     #region Create && Configure New UMA Material
    86.     UMAMaterial umaMat = (UMAMaterial)ScriptableObject.CreateInstance(typeof(UMAMaterial));
    87.  
    88.     umaMat.material = new Material(newMatJean);
    89.     umaMat.channels = new UMAMaterial.MaterialChannel[1];
    90.     umaMat.channels[0] = new UMAMaterial.MaterialChannel();
    91.     umaMat.channels[0].channelType = UMAMaterial.ChannelType.Texture;
    92.     umaMat.channels[0].materialPropertyName = "_MainTex";
    93.     #endregion
    94.  
    95.     #region Configure Overlay Data Asset
    96.     overlayDataAssetNewJean.material = umaMat;
    97.  
    98.     overlayDataAssetNewJean.textureList = new Texture[1];
    99.     overlayDataAssetNewJean.textureList[0] = Texture.Instantiate(newMatJean.mainTexture);
    100.     #endregion
    101.  
    102.     OverlayData overlayDataNewJean = new OverlayData(overlayDataAssetNewJean);
    103.  
    104.     #region Update Character
    105.     uMAWardrobeRecipe.GetUMARecipe().GetSlot(slotIndex).SetOverlay(overlayIndex, overlayDataNewJean);
    106.  
    107.     UMACharacter.WardrobeRecipes["Legs"] = uMAWardrobeRecipe;
    108.  
    109.     UMACharacter.ForceUpdate(false, true, false);
    110.     #endregion
    111.   }
    112.  
    113.   public void OnDisable()
    114.   {
    115.     ODA_Jean_Source.material = umaMaterialOrig;
    116.     ODA_Jean_Source.textureList = texturesOrig;
    117.   }
    118. }
     
  21. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Look in the "Race Animator Controller" settings. It probably has an override.

    For the hair, I'll add something to the converter to handle this in the next update.

     
  22. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    UMA 2.10.2 is coming soon.

    The biggest update is:

    Edit time UMAs!

    Yes - they behave like you expect. There is a new section on the DynamicCharacterAvatar to generate UMA's.
    You can see the result at edit time, and precisely position them. Change their colors, add wardrobe, edit DNA, etc. You can duplicate the UMA with Ctrl-D. You can create a prefab by dragging the UMA from the scene to a folder. And of course, it's optional, so you don't have to have them if you don't want.

    I'll be asking for alpha testers soon! :)

    Here's a quick peek:
    Pardon the mouse being off (windows video capture).
    And Pardon the pauses in the video. I'm running Unity from an old USB drive, so it takes it's time doing some things.

     
  23. Cam-2012

    Cam-2012

    Joined:
    Jan 3, 2019
    Posts:
    1
    Would be more then happy to test that looks awesome great work.
     
  24. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    It might be a good idea to add a slot builder option to see if it's possible to "normalize" the uv... many content workflows gives separate areas to each piece trusting the uv to repeat. It's only when an object's uv coordinates actually crosses integer borders that there is a problem.
     
    Jaimi likes this.
  25. Tomi-Tukiainen

    Tomi-Tukiainen

    Joined:
    Jun 8, 2013
    Posts:
    26
    Hi, I just tried to update to latest UMA version with Addressables enabled and it sort of failed badly. I went on to test by importing UMA package to an empty project, pulling UMADynamicCharacterAvatar prefab from Getting Started folder to the scene and hitting play...

    Results: It works when UMA is not set to use Addressables but causes error when UMA is set to use Addressables. Can anyone help me with this?

    Here is the stack trace:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.ResourceManagement.AsyncOperations.InitalizationObjectsOperation.Execute () (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/Initialization/InitializationObjectsOperation.cs:28)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].InvokeExecute () (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:413)
    UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject].Start (UnityEngine.ResourceManagement.ResourceManager rm, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency, DelegateList`1[T] updateCallbacks) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/ResourceManager/AsyncOperations/AsyncOperationBase.cs:407)
    UnityEngine.ResourceManagement.ResourceManager.StartOperation[TObject] (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationBase`1[TObject] operation, UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle dependency) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/ResourceManager/ResourceManager.cs:411)
    UnityEngine.AddressableAssets.Initialization.InitializationOperation.CreateInitializationOperation (UnityEngine.AddressableAssets.AddressablesImpl aa, System.String playerSettingsLocation, System.String providerSuffix) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/Initialization/InitializationOperation.cs:59)
    UnityEngine.AddressableAssets.AddressablesImpl.InitializeAsync (System.String runtimeDataPath, System.String providerSuffix, System.Boolean autoReleaseHandle) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/AddressablesImpl.cs:390)
    UnityEngine.AddressableAssets.AddressablesImpl.InitializeAsync () (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/AddressablesImpl.cs:399)
    UnityEngine.AddressableAssets.AddressablesImpl.get_ChainOperation () (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/AddressablesImpl.cs:123)
    UnityEngine.AddressableAssets.AddressablesImpl.LoadAssetsAsync[TObject] (System.Collections.Generic.IList`1[T] keys, System.Action`1[T] callback, UnityEngine.AddressableAssets.Addressables+MergeMode mode) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/AddressablesImpl.cs:586)
    UnityEngine.AddressableAssets.Addressables.LoadAssetsAsync[TObject] (System.Collections.Generic.IList`1[T] keys, System.Action`1[T] callback, UnityEngine.AddressableAssets.Addressables+MergeMode mode) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/Addressables.cs:427)
    UMA.UMAAssetIndexer.LoadLabelList (System.Collections.Generic.List`1[T] Keys, System.Boolean keepLoaded) (at Assets/UMA/Core/Scripts/UMAAssetIndexer.cs:1013)
    UMA.UMAAssetIndexer.Preload (UMA.CharacterSystem.DynamicCharacterAvatar avatar, System.Boolean keepLoaded) (at Assets/UMA/Core/Scripts/UMAAssetIndexer.cs:930)
    UMA.CharacterSystem.DynamicCharacterAvatar.LoadCharacter (UMA.UMARecipeBase umaRecipe, System.Collections.Generic.List`1[T] Replaces, System.Collections.Generic.List`1[T] umaAdditionalSerializedRecipes, UMA.UMARecipeBase[] AdditionalRecipes, System.Collections.Generic.Dictionary`2[TKey,TValue] MeshHideDictionary, System.Collections.Generic.List`1[T] hiddenSlots, System.Collections.Generic.List`1[T] HideTags, UMA.UMADnaBase[] CurrentDNA, System.Boolean restoreDNA, System.Boolean skipBundleCheck) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:3125)
    UMA.CharacterSystem.DynamicCharacterAvatar.BuildCharacter (System.Boolean RestoreDNA, System.Boolean skipBundleCheck) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:2996)
    UMA.CharacterSystem.DynamicCharacterAvatar.BuildFromComponentSettings () (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:559)
    UMA.CharacterSystem.DynamicCharacterAvatar.Start () (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:421)
     
  26. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Using addressables requires that you follow the steps to get it going as documented in the "read me now" file.

    1. Install the addressables package and generate the settings it needs.
    2. Run the "single group generator (fast)" group generator on the global library.
    3. Open the addressables groups window, and build the bundles.

    Once you have done this, it should work.


     
    hopeful likes this.
  27. Tomi-Tukiainen

    Tomi-Tukiainen

    Joined:
    Jun 8, 2013
    Posts:
    26
    Thanks Jaimi, indeed I must have failed with Addressables last time. I got the empty project working by generating addressables from Global Library window and then building from the Addressables window. Unfortunately I have some nullref still in the real game project that I'm trying to update to latest UMA.

    When I installed addressables package to my project it notified me about "Legacy Bundles Detected". I was offered an option to auto convert them (11 bundles) to addressables. I answered Ignore because I didn't know what components exactly it would affect in our project.

    Tried again for the real project:

    1. Deleted UMA entirely
    2. Imported latest package 2.10.1
    3. Global Library > Rebuild from project
    4. Global Library > Addressables > generate single group (fast) // takes some time
    5. Addressables Groups > Build > New Build > Default Build Script // takes some time
    6. Pull UMA_GLIB and UMADynamicCharacterAvatar to scene

    And the result is another kind of nullref:

    NullReferenceException: Object reference not set to an instance of an object
    UMA.UMAData.AddAdditionalRecipes (UMA.UMARecipeBase[] umaAdditionalRecipes, UMA.UMAContextBase context, System.Boolean mergeMatchingOverlays) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAData.cs:1770)
    UMA.CharacterSystem.DynamicCharacterAvatar.LoadCharacter (UMA.UMARecipeBase umaRecipe, System.Collections.Generic.List`1[T] Replaces, System.Collections.Generic.List`1[T] umaAdditionalSerializedRecipes, UMA.UMARecipeBase[] AdditionalRecipes, System.Collections.Generic.Dictionary`2[TKey,TValue] MeshHideDictionary, System.Collections.Generic.List`1[T] hiddenSlots, System.Collections.Generic.List`1[T] HideTags, UMA.UMADnaBase[] CurrentDNA, System.Boolean restoreDNA, System.Boolean skipBundleCheck) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:3168)
    UMA.CharacterSystem.DynamicCharacterAvatar.LoadWhenReady (UnityEngine.ResourceManagement.AsyncOperations.AsyncOperationHandle`1[TObject] Op) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:3035)
    UnityEngine.Debug:LogException(Exception, Object)
    UMA.CharacterSystem.DynamicCharacterAvatar:LoadWhenReady(AsyncOperationHandle`1) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:3053)
    DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ChainOperationTypelessDepedency`1:OnWrappedCompleted(AsyncOperationHandle`1)
    DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ChainOperation`2:OnWrappedCompleted(AsyncOperationHandle`1)
    DelegateList`1:Invoke(AsyncOperationHandle`1) (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/ResourceManager/Util/DelegateList.cs:69)
    UnityEngine.ResourceManagement.ResourceManager:Update(Single)
    MonoBehaviourCallbackHooks:Update() (at Library/PackageCache/com.unity.addressables@1.8.5/Runtime/ResourceManager/Util/MonoBehaviourCallbackHooks.cs:19)

    After this I tried tinkering with it in various ways:

    - Tried a Clean Build for Addressables
    - Tried re-installing UMA a few times
    - Restarted Unity Editor
    - etc, etc,..
    - It also ended up asking again about converting those 11 bundles and I answered yes.

    Nope, it still doesn't work. Maybe it has cached some invalid stuff somewhere.
     
    Last edited: Oct 8, 2020
  28. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Please review your UMA preferences, and make sure you do not check "include recipes" or "include all other types".

    If you do this, you must manage those yourself, by calling LoadLabelList.


     
  29. StarChick971

    StarChick971

    Joined:
    Nov 28, 2015
    Posts:
    118
    I updated UMA again to v2.10.1 and still same problem until I update Unity to version 2019.4.12f1, the avatar is working again. I guess I had troubles with previous version of Unity somehow...
     
  30. Tomi-Tukiainen

    Tomi-Tukiainen

    Joined:
    Jun 8, 2013
    Posts:
    26
    Hi, it was not that. I tried also without Addressables and got a couple of different kind of errors, this is the latest. I think I'll just revert my project back to the old version for now.

    NullReferenceException: Object reference not set to an instance of an object
    UMA.UMAData.AddAdditionalRecipes (UMA.UMARecipeBase[] umaAdditionalRecipes, UMA.UMAContextBase context, System.Boolean mergeMatchingOverlays) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAData.cs:1770)
    UMA.CharacterSystem.DynamicCharacterAvatar.LoadCharacter (UMA.UMARecipeBase umaRecipe, System.Collections.Generic.List`1[T] Replaces, System.Collections.Generic.List`1[T] umaAdditionalSerializedRecipes, UMA.UMARecipeBase[] AdditionalRecipes, System.Collections.Generic.Dictionary`2[TKey,TValue] MeshHideDictionary, System.Collections.Generic.List`1[T] hiddenSlots, System.Collections.Generic.List`1[T] HideTags, UMA.UMADnaBase[] CurrentDNA, System.Boolean restoreDNA, System.Boolean skipBundleCheck) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:3168)
    UMA.CharacterSystem.DynamicCharacterAvatar.BuildCharacter (System.Boolean RestoreDNA, System.Boolean skipBundleCheck) (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:2996)
    UMA.CharacterSystem.DynamicCharacterAvatar.BuildFromComponentSettings () (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:559)
    UMA.CharacterSystem.DynamicCharacterAvatar.Start () (at Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/DynamicCharacterAvatar.cs:421)
     
  31. StarChick971

    StarChick971

    Joined:
    Nov 28, 2015
    Posts:
    118
    Try with a different version of Unity... because I have got similar error since weeks I did exact same things as you did. Who knows it might work.
     
  32. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You should also make sure that your "Additional Utility Recipes" does not have a null item in it.

     
  33. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    Can you people please post links to the game you are making that uses UMA?
     
  34. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    Animmal's The Way of Wrath uses UMA with custom models (along with the Dialogue System, Quest Machine, and Love/Hate).



    Their modeler has posted some devlogs about their modeling process.
     
  35. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    WOW, Impressive, is that desktop computer game? Is it multiplayer? Nice animations!! Great work!

    Anybody using UMA on mobile (Android/IOS)?
     
  36. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    I'm not on the Way of Wrath team. I just provide some of the underlying assets that the game systems use for dialogue and quests. I included a link to their game so you can learn more about it.
     
  37. Rick8684n

    Rick8684n

    Joined:
    Apr 2, 2020
    Posts:
    3
    I was following the tutorials on converting models into wardrobe items.

    I followed then precisely, and turned a mask from the asset store into an item. I spent quite some time altering the vertices and positioning it perfectly over the eyes. It looks great in Blender, and converts to a wardrobe item perfectly.

    But, once imported, the mask decided it needs to be rotated by 90°. There is no way to rotate the item correctly that I can see, and I can see absolutely no reason for this, or find anything anywhere on the subject.
    Does anyone have any ideas? Or some idea where to look for answers?

    <blockquote class="imgur-embed-pub" lang="en" data-id="rbO45lC"><a href="https://imgur.com/rbO45lC">View post on imgur.com</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
    <blockquote class="imgur-embed-pub" lang="en" data-id="tOjOx15"><a href="https://imgur.com/tOjOx15">View post on imgur.com</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>

    https://imgur.com/rbO45lC
    https://imgur.com/tOjOx15
     
  38. bc732

    bc732

    Joined:
    Oct 8, 2020
    Posts:
    2
    Hi all, new here.

    I am trying to dynamically change my character's height dna in a script that runs when "Character Created," using something like:

    dna = avatar.GetDNA();
    dna["height"].Set(newHeight);
    avatar.ForceUpdate(true);

    My problem is that the Inspector shows the height dna as being newHeight, but the character stays the same size.

    What am I doing wrong?

    Edit: Unity 2020.1.8f1, UMA 2.10.1
     
  39. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    It sounds like a Blender to Unity issue. Does this video help?

     
  40. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You can't update the character in the CharacterCreated or CharacterUpdated events. Those happen as part of the build process, and triggering another build would cause a loop.

    You can handle this different ways. If you want your height to always be modified for everyone, then you can edit the dnaconverter on the race, and there is a scale at the bottom you can use.
    If you want to use DNA that is set before you build the character, you need to load it into the predefined DNA.
    There are sample scenes that show how to do this: "How to construct a character from a prefab" and "How to construct a character from scratch".
    2.11 is coming soon, and will allow you to predefine the DNA in the inspector at edit time.
     
    hopeful and bc732 like this.
  41. bc732

    bc732

    Joined:
    Oct 8, 2020
    Posts:
    2
    Thank you. That explains it. I am actually looking to set the height based on the height of my VR rig, for VRIK. So I will go about it a different way.
     
  42. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    137
    Hey guys, I'm really blown away by UMA. It's really wonderful. While making some stuff straight from my dreams, I've run into a straightforward resource management/editor usability problem. I think it's straightforward, anyway.

    I've added a bunch of slots, overlays, and recipes to my main database. No matter what scene I'm in in my project, even an empty scene, according to the profiler, UMA textures are taking up 15 GB of space. This increases the time it takes to enter playmode by about 45 seconds (because it's putting me over the top on ram usage). I'm just trying to figure out how to not load all those textures into memory at once, or greatly reduce the footprint. Do others run into this, and if so how has everyone dealt with it?

    Thanks for your time!
     
  43. Magic-Thor

    Magic-Thor

    Joined:
    Mar 31, 2020
    Posts:
    15
    [obsolete / depricated / removed] UMA -> Ultimate Character Controller

    Hi...

    If I install the UMA integration for UCC ( https://opsive.com/downloads/?pid=923 ) I become the following warnings:

    Assets\UMA\Core\Extensions\DynamicCharacterSystem\UMAAssetBundleManager\BuildScript.cs(396,10): warning CS0618: 'BuildTarget.StandaloneLinux' is obsolete: 'StandaloneLinux has been removed in 2019.2'
    Assets\UMA\Core\Extensions\DynamicCharacterSystem\UMAAssetBundleManager\BuildScript.cs(398,10): warning CS0618: 'BuildTarget.StandaloneLinuxUniversal' is obsolete: 'StandaloneLinuxUniversal has been removed in 2019.2'
    Assets\UMA\Core\Editor\Scripts\UMAEditorUtilities.cs(80,4): warning CS0618: 'PreferenceItem' is obsolete: '[PreferenceItem] is deprecated. Use [SettingsProvider] instead.'
    Assets\UMA\Core\Editor\Scripts\UMABonePoseEditor.cs(206,4): warning CS0618: 'SceneView.onSceneGUIDelegate' is obsolete: 'onSceneGUIDelegate has been deprecated. Use duringSceneGui instead.'
    Assets\UMA\Core\Editor\Scripts\UMABonePoseEditor.cs(220,4): warning CS0618: 'SceneView.onSceneGUIDelegate' is obsolete: 'onSceneGUIDelegate has been deprecated. Use duringSceneGui instead.'

    Edit: I Don't know where can I report warnings like this...

    Best regards
    Thor
     
  44. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Hi - I'm addressed these in the current development branch, they will be part of 2.11

    Thanks,

    Jaimi
     
    Magic-Thor likes this.
  45. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Hi Alic -

    Yes, this is a common problem if you use a huge number of assets. But, we have addressed this in 2.10. If you use Addressables, then UMA will demand load the slots and textures as needed and unload them when not in use.

    Using addressables takes some minor setup, and you have to be sure you use the DynamicCharacterAvatar, and use it as it was designed to be used. If not, you can run it to many issues.

    Jaimi
     
    TeagansDad and Alic like this.
  46. Alic

    Alic

    Joined:
    Aug 6, 2013
    Posts:
    137
    Hey Jaimi! Wonderful that you guys have already solved this! Sorry I missed addressables in the docs.

    I followed the instructions (really fast to setup, only a couple of minutes). I ran into one issue that took a couple of hours to solve, just because it was hard to debug. When running the "UMA DCS Demo - Simple Setup" I found that one of my custom races wasn't working, and the log was getting the error "Can't find slot... etc" for the eyebrows slot of the character. I can recreate and post the actual error text if it would be helpful.

    The issue ended up being that the race recipe I'd created, which actually had identical slots to other races that were working fine, was not part of the global library. In other words, just the race recipe object wasn't part of the global library. All of the slots and overlays in the recipe were in the global library, so the error message was quite far from what was going on. The character was also being generated with no errors before I switched over to addressibles, despite the fact that its race recipe was not part of the global library.

    Anyway, just wanted to share the experience in case anyone else runs into the same issue when upgrading to addressibles.

    I'm happy to say that switching to addressibles has 100% solved the issue I was having with editor slowdown. Thanks so much for your help, Jaimi!
     
    hopeful and Jaimi like this.
  47. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Alright, I'm glad you got it going. I didn't realize that would be an issue - I should put a warning on the race if it's not in the library. I'll try to get that into 2.11.
     
    hopeful and Alic like this.
  48. colpolstudios

    colpolstudios

    Joined:
    Nov 2, 2011
    Posts:
    150
    Hey Jaimi, a few of us UMA users are having an issue when using Invector and shooting.

    I have an uma as the character and have gone through the setup process for this shooter character.

    Using the bone builder tool. Then take this object into the charactor creator window.

    So far, so good. everything works as expected you can run, jump, roll. Etc.

    Following this tutorial:


    I add a gun, however, no gun weapon will actually shoot.

    I am thinking of purchasing the DK UMA so asked them did they have this issue.

    Reply:

    "thank you for your interrest about DK UMA.

    yes, the avatar is able to shoot when using a shooter weapon."

    Obvisoly we are doing something wrong, but cant figure out what?
     
  49. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I don't have the invector shooter controller, only the melee controller. I do not know what might be causing the issue with invector, sorry.

     
  50. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,686
    I can make a guess. I don't have Invector either. But what UMA does is it makes a dictionary of everything added to the rig, and this means every game object the controller adds to the rig needs to have a unique name. I bet Invector is using some duplicate names, and that's the problem.

    Like, if you can have two gun models attached to the rig and both are called "gun," my understanding is that UMA will cough up a hairball if you try to rebuild the character while those two duplicate names are present.