Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

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

  1. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    And... that's because events ignore Rebuild commands, so I now set a flag after changing the DNA and then call Rebuild from Update() once this flag has been set.
     
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779

    You are in a bit of a catch-22 situation.

    You can't force the character to rebuild in the event, because that would cause it to re-queue the item to build, and then that would call the event again. So we specifically filter that out so as to avoid infinite loops.

    You can approach this several ways.

    Simplest thing is to just start a coroutine, and then have that coroutine tell it to rebuild. But you need to take care not to get stuck in a loop (set a flag somewhere so you don't process that specific avatar over and over again).

    The other thing is to simply generate a bunch of random characters, save them as strings, and then load randomly load those. This will be less resource intensive.

    I'll put in a trello task to allow the pregeneration of DNA, but it won't make 2.8
     
    terrycheung and LoekvanKooten like this.
  3. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    610
    This is only true if you want to use the nice high level interfaces. You can absolutely do whatever you want to the DNA before generation. If you look at the old UMACrowd example it randomizes everything programmatically prior to building the characters.

    EDIT: I haven't been in the code for a long time, but there are also other events than CharacterCreated, some of which I think may be called prior to the DNA being applied.
     
    Jaimi likes this.
  4. MicCode

    MicCode

    Joined:
    Nov 19, 2018
    Posts:
    5
  5. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    LoekvanKooten is using a DynamicCharacterAvatar, which creates the UMAData and loads the DNA from the race into at build time.

    But perhaps there is a better event, that would avoid the double-build. It would have to be after initialization. Let me look.
     
    Last edited: Feb 5, 2019
  6. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    @LoekvanKooten - try to put your randomize in the "CharacterBegun" event.
    At that point, it should have a UMAData, but it has not generated anything yet.

    @ecurtz - thanks, I should have thought of that to begin with.
     
    Last edited: Feb 5, 2019
    LoekvanKooten and hopeful like this.
  7. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    Will try and let you know! Got to solve some performance issues first. FPS spikes of 15 FPS on a 1080 Ti.
     
  8. umutozkan

    umutozkan

    Joined:
    Oct 30, 2015
    Posts:
    310
  9. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    No, that doesn't work (it does nothing). Back to my previous solution: put it in Update() and stop calling it as soon as a bool has been set.
     
  10. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    Not sure what went wrong.

    I created this function in SampleCode.cs:

    Code (csharp):
    1.  
    2.         private bool Randomized = false;
    3.  
    4.         public void RandomHead()
    5.         {
    6.             if (!Randomized)
    7.             {
    8.                 Dictionary<string, DnaSetter> Dna = Avatar.GetDNA();
    9.                 Dna["headSize"].Set(Random.Range(0f, 1f));
    10.                 Debug.Log("Set headSize to " + Dna["headSize"].Value);
    11.                 Randomized = true;
    12.             }
    13.         }
    14.  
    And added it to the CharacterBegun event. The event fired, and the head was randomized:


    RandomHead.jpg
     
    terrycheung and kenamis like this.
  11. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    In Character Begun I have:

    Code (CSharp):
    1.         public void RandomizeAvatar()
    2.         {
    3.             Random.InitState((int)System.DateTime.Now.Ticks);
    4.             setters = avatar.GetDNA();
    5.             int randomHairNumber = Random.Range(1, 10);
    6.             string hairString = "MHair" + randomHairNumber;
    7.             avatar.SetSlot("Hair", hairString);
    8.  
    9.             // Set random DNA
    10.             setters = avatar.GetDNA();
    11.             foreach (KeyValuePair<string, DnaSetter> dna in setters)
    12.             {
    13.                 float newValue = 0.45f + (Random.value * 0.1f);
    14.                 dna.Value.Set(newValue);
    15.             }
    16.  
    17.             // Set random colors
    18.             int RandHair = Random.Range(0, HairColors.colors.Length);
    19.             int RandSkin = Random.Range(0, SkinColors.colors.Length);
    20.  
    21.             avatar.SetColor("Hair", HairColors.colors[RandHair]);
    22.             avatar.SetColor("Skin", SkinColors.colors[RandSkin]);
    23.             haveIRandomized = true;
    24.             print(gameObject + " randomized");
    25.         }
    In DNA Updated I have:

    Code (CSharp):
    1.         public void RebuildCharacter()
    2.         {
    3.             avatar.BuildCharacter(true);
    4.             avatar.ForceUpdate(true, true, true);
    5.             print(gameObject + " rebuilt");
    6.         }
    Both methods are called and print their messages (once for every enemy), but the meshes don't change. All four enemies stay exactly the same.
     
  12. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    You do not need that second function in DNA Updated. I'm not sure what is happening, but that could be messing things up.

    Also - the hair won't change there, because the character has not been built - but you can't build the character in an event, because it changes the recipe. You will need to set the slots outside of an event.

    Are you getting any errors or warnings in the console?

    Note: I'm working on a system to provide pregenerated DNA to the DCA. But it won't be ready until 2.9
     
    Last edited: Feb 6, 2019
    LoekvanKooten likes this.
  13. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    69
    Hi, is there a way to use blendshape on wardrobe items?
    For example I have several different head models and I thought of using blendshapes on beards to mold them into the faces. So I could equip head three and turn on blendshape 3 on a beard. Is something like this possible?
     
  14. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    Yes - you just have to setup the DNA for it. Look at the ElfOrAlien DNA in the 2.8 RC for an example of blendshape DNA.
     
  15. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    69
    @Jaimi
    Thanks! Does that work for wardrobe items or only base slots? A bit confused on that part. Or since the mesh is baked in the end it does not matter?
     
  16. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    It should work for any slot. The slots can have DNAConverters associated with them, and that will merge into the races DNA.
     
  17. LoekvanKooten

    LoekvanKooten

    Joined:
    Apr 3, 2017
    Posts:
    120
    In that case, my old method seems best, as I do not only want to change the DNA, but also change the hair at random.

    I wasn't getting any errors.
     
  18. arteria

    arteria

    Joined:
    May 31, 2007
    Posts:
    2,081
    UMA users!

    Arteria3d have received many emails detailing the recent promotion ive ran for UMA users, asking was we doing more, as it seems its a great idea for new users especially to evaluate the products before purchase, given many are new to UMA too, therefore each week, we will offer 1 UMA costume FREE from our store to any first time Requestee. Simply email arteria3d@live.co.uk with your UMA costume choice from our grand selection via the link below. (Please note, FULL Knight and Viking packs not included)

    Arteria3d UMA Costumes:
    https://arteria3d.myshopify.com/collections/uma
     
  19. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    334
    If I understand what you want correctly (set a different DNA Value depending on whether another slot is present or not). That you'll have to do in a script attached to an empty slot in your wardrobe recipe which will search for the slots and set your dna depending on your needs. By the way, this kind of logic is planned in the future for UMA 3.

    A blendshape is not automatically baked in an UMA. By default it will exist like normal on the final uma skinned mesh renderer. There is an UMA feature to bake the blendshape and that should be a perfect use-case in this instance.
     
  20. Hellwaiker

    Hellwaiker

    Joined:
    Jan 8, 2016
    Posts:
    69
    Thank you!

    Awesome, Yes. If Face_01 is equipped set Beard_Blendshape_01 to 1 etc. I'll have meshes in a day or two from Artist and I'll try this.
    I was looking on wardrobe item asset for Blendshape data and did not realize they were connected to slots.
     
    kenamis likes this.
  21. InfinityCubeInteractive

    InfinityCubeInteractive

    Joined:
    Jan 6, 2016
    Posts:
    8
    Hi guys,

    im woundering if there is an easy way to get all available Wardrope slots?

    I would need that for the Custom Inspector of my Character Equipment Class.

    thanks!
     
  22. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    Yeah - they're available on the race. But you can also pull them from the DCA using CurrentWardrobeSlots(), which returns a List<string>
     
  23. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    643
    Hello,

    I just upgraded my UMA from an old version to the current version, now im getting these errors after importing, can someone help? Thanks!

    Assets/Standard Assets/UMA/Core/Scripts/UMAMeshData.cs(8,11): error CS0234: The type or namespace name `Dynamics' does not exist in the namespace `UMA'. Are you missing an assembly reference?

    Assets/Standard Assets/UMA/Core/Scripts/RaceData.cs(17,52): error CS0246: The type or namespace name `INameProvider' could not be found. Are you missing an assembly reference?

    Assets/Standard Assets/UMA/Core/Scripts/SlotDataAsset.cs(9,89): error CS0246: The type or namespace name `INameProvider' could not be found. Are you missing an assembly reference?

    Assets/Standard Assets/UMA/Core/Scripts/UMADefaultMeshCombiner.cs(17,11): error CS0246: The type or namespace name `UMAClothProperties' could not be found. Are you missing an assembly reference?

    Assets/Standard Assets/UMA/Core/Scripts/UMAMaterial.cs(14,16): error CS0246: The type or namespace name `UMAClothProperties' could not be found. Are you missing an assembly reference?
     
  24. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    You have a mix of versions. You should delete the core and examples folders, and reimport.

     
  25. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    643
    Yes I did that and it worked thanks!

    Im using the photoboth scene, and after designing a character i want to get a string of the recipe so i can save it to a file, and then load it back next time and apply it to the UMA character.

    1. Can you tell me how to get a string of the recipe (DNA and clothes shoes, hair, colors etc), which function to call?
    2. Can you tell me how to apply the recipe to a character? which functions to call?

    Or if you have example code for both?

    Thanks
     
  26. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    Great.

    Yes, it's quite easy:

    string savedAvatar = Avatar.GetCurrentRecipe(false); // this gets the state of the avatar (including DNA, Colors, Wardrobe, Race, etc)

    Avatar.LoadFromRecipeString(savedAvatar); //this loads the avatar from the string above.
    BuildCharacter(); // this will regenerate him
     
    hopeful likes this.
  27. Viggy1996

    Viggy1996

    Joined:
    May 11, 2017
    Posts:
    39
    Hey! I am using a specular workflow for my UMAs. When I try to add recipes to my UMA, the base slots have the right specular smoothness , but my armor recipes become dull. When I increase the specular smoothness of the material, the Base Slot becomes too shiny while the Armor recipes appear correctly. Any idea, how to overcome this?
     
  28. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    643
    im trying out the "UMA DCS Demo - Using Asset Bundles" scene, when i click LOAD then some of the selections give an error that it can't find some slot or recipe, i also saw some message that i should re-build UMAResources index or AssetBundles.

    Can you please tell me how to solve those? Thanks!
     
  29. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    Most likely the issue is the colors being applied to the armor. Look in your wardrobe recipes at the colors for Texture 1 multiplier and Texture 1 additive. For your specular maps to remain unchanged, the multiplier should be 1,1,1,1 and additive should be 0,0,0,0
     
  30. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    To rebuild the index, open the global library window, and hit the "Rebuild from project (adds everything)" button. That will add everything it finds into the global index, except for things that are in asset bundles.

    To rebuild your asset bundles, you should open the asset bundle manager, and hit the button to build the asset bundles.
    However, you shouldn't need to do this inside the editor - only for when you build.

    If you need further assistance, I will need to know some of the items that can't be found.
     
  31. iyango

    iyango

    Joined:
    Jan 26, 2019
    Posts:
    4
  32. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    Done. Check your spam box if you don't see the invite in a few minutes, sometimes it ends up there.
     
  33. iyango

    iyango

    Joined:
    Jan 26, 2019
    Posts:
    4
    Thank you :)
     
  34. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    334
    To double check, you're using the specular UMA Material, correct?
     
  35. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    643
    Hello,

    I was using your scene "UMA DCS Demo - Using Asset Bundles", when i click LOAD, it brings up a dialog box containing existing recipies i can pick.

    After playing around with it for a while, dont know what i did, but when i click LOAD now the dialog box is empty, all the pre-existing recipes have disappeared

    Do you know how to get them back?

    Thanks
     
  36. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    I would start by rebuilding the library. Open the global library, and press the "Rebuild from project" button.
     
  37. Ziron999

    Ziron999

    Joined:
    Jan 22, 2014
    Posts:
    238
    The only feature i'm interested in is combining skinned meshes from models that are the same.
    My models are instanced via a network signal on a public server. Since the objects are not pooled i need a way to create a <List>pool for the skinned meshes when the models are the same. Is this possible? If so, HOW!
     
  38. Firlefanz73

    Firlefanz73

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

    Is there a way to make all UMA stuff a Little bit brighter? It seems to be so dark…
    Or do I have to pick every material and make this a bit brighter?

    Thanks :)
     
  39. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    163
    how do we globally add a new race to recipes project wide?
     
  40. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    You can look at the SkinnedMeshCombiner. But maybe you should just look at instancing. This project requires some special setup, so perhaps it's not what you need.



     
  41. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    They just use the standard shader, so the regular lighting all applies. You could use the additive function on the colors also, or edit the template material to add a little bit of emissive? That seems kind 9f cheaty though.

     
    Firlefanz73 likes this.
  42. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,779
    You can make your race cross compatible with another race that is on the recipes, then it should work without adding them everywhere.
     
  43. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,079
    Thanks Jaimi.
     
  44. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    643
    Anybody knows why the character creation event doesnt fire? I want it to call my function after the character gets created, but it never gets called even though the character gets created.


    Here is my code;

    public class MyClass: Monodevelop {
    ...
    public void myFunc()
    {
    avatar = gameObject.GetComponent<DynamicCharacterAvatar>();
    ....
    avatar.LoadFromRecipeString(avatarData); //this loads the avatar from the string above.
    avatar.BuildCharacter(); // this will regenerate him
    avatar.CharacterCreated.AddListener(gameObject.GetComponent<UMAzingSpawn>().CreateLocomotion);
    }



    public class UMAzingSpawn ....

    public void CreateLocomotion(UMA.UMAData umaData)
    {
    Debug.Log("UMA CHARACTER CREATED");
    Locomotion loco=gameObject.AddComponent<Locomotion>();
    Debug.Log("LOCOMOTION ADDED:"+loco);
    }
     
  45. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    610
    Try adding it before you call BuildCharacter()
     
  46. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    643
    Thanks i tried that and it still didnt work... the character got created and appears in the scene.
     
  47. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    610
    Hmm, CharacterCreated gets invoked from UmaData.FireUpdatedEvent() try sticking a breakpoint or Debug.Log in there and see if it's just getting hit earlier or not at all.
     
  48. ComputerMisery

    ComputerMisery

    Joined:
    Sep 23, 2018
    Posts:
    1
    does anyone know if there is a fix for the import error with:
    • UMA 2: Unity Multipurpose Avatar (basic) unity asset
    • Unity 2018.3.0f2
    It is broken on import. I'd like to do something with avatars, but I'm new.

    The error is:
    Code (CSharp):
    1. Assets\UMA\Core\StandardAssets\UMA\Scripts\UMAMeshData.cs(618,34): error CS0117: 'PrefabUtility' does not contain a definition for 'IsComponentAddedToPrefabInstance'
    The package is directly from the asset store. I found the new unity package from this forum; I tried downloading the unity package but I got a 'Failed - forbidden' message.
     
    Last edited: Feb 10, 2019
  49. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    643
    Hello,

    My project runs fine in the editor, but when I build for WebGL and run it in the browser i get the error that it cant find the eye overlay, and of course the character does not get created.

    [DynamicCharacterSystem] could not find MaleBeard3 in Resources or any AssetBundles. Do you need to rebuild your UMAResources Index or AssetBundles?

    [DynamicCharacterSystem] could not find MaleUnderwear in Resources or any AssetBundles. Do you need to rebuild your UMAResources Index or AssetBundles?

    UMAResourceNotFoundException: dOverlayLibrary: Unable to find: Eye Overlay
    at UMA.CharacterSystem.DynamicOverlayLibrary.InstantiateOverlay (System.String name) [0x00000] in <00000000000000000000000000000000>:0


    Sorry but i dont really know the details on how UMA works and where its data gets stored. Maybe the UMA overlays are not in the resource folder so its not included in the WebGL build?

    Anybody knows how to fix?

    Thanks!
     
    Last edited: Feb 10, 2019
  50. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    610
    You can go and comment out that 3 lines of code where you're getting the error for now, it's just there to protect you from making an "illegal" save in Editor mode. Unity must have removed that call, but I don't know when.