Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

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

  1. rossdp

    rossdp

    Joined:
    Apr 28, 2017
    Posts:
    19
    Just FYI, seems like there are a few search/replace items you might want to consider.

    I made a brand new project. I installed UMA 2.5.0 from the store. Restarted Unity, it tells me UMA 2.5.1 is available. I downloaded that and imported it, and then I get this popup:



    I committed everything to Git, and then I clicked the "I Made a Backup. Go Ahead!" button.

    After it finished processing what seemed like a ton, here are the files that were different:



    Looking through the diff, it looks like it did the following replacements:

    In shader files:

    Code (CSharp):
    1. -    o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
    2. +    o.pos = UnityObjectToClipPos (v.vertex);
    In C# files:

    Code (CSharp):
    1. -  Transform rendTrans = dstTarget.FindChild("UMARenderer");
    2. +  Transform rendTrans = dstTarget.Find("UMARenderer");
     
  2. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Yeah, that update button should not be there. It has caused issues for us too. I suggest you download 2.5 again and ignore any update notice.
     
  3. rossdp

    rossdp

    Joined:
    Apr 28, 2017
    Posts:
    19
    It seems to be working fine. The Unity API docs for FindChild vs Find seem to indicate that it's the same thing, apparently they just no longer like the FindChild variant. I imagine this is part of the process of Unity trying to get people to stop using those old API methods so they don't have to support them any longer.

    (I just updated to Unity 5.6.1 this morning fwiw).
     
    Teila likes this.
  4. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    Hi, I'm working on a fully procedural project, and I really need to know the proper way to load a WardrobeSet, onto a DynamicCharacterAvatar from code. I randomly generate the WardrobeSet (a List<Wardrobsettings>) from a WardrobeRecipe library I created adapting the slot library a bit. I try to load it on Start from another script and this seems to mess with the UMA Data script, so the avatar doesn't load. I'm using dca.LoadWardrobeSet(outfit), where dca is a reference to the DynamicCharacterAvatar and outfit is a List<Wardrobsettings>... Do I have to somehow update afterwards, do I have to call it from somewhere else (Update or Awake)? Is it a matter of the order in which scripts are loaded?
    I had learned UMA 2 thanks to SecretAnorak. However, the 2.5 update broke a lot of the stuff I did in the upgrade. So... I'm trying to generate procedural crowds again, I thought using using the wardrobe system would allow me to upgrade from my previously naked crowds (lol). So far everything it works great if you preset everything, but I'm having a tough time in getting it to work from code...
    Any help would be greatly appreciated.
     
    Last edited: May 20, 2017
  5. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208

    To have an Avatar put on a WardrobeCollection is the same as putting on an individual item - Just pass the UMAWardrobeCollection instead of the UMAWardrobeRecipe, and it will sort it all out:

    Avatar.SetSlot(theWardrobeCollection); // Set the wardrobe collection. This will add all the individual recipes.
    Avatar.BuildCharacter(); // Rebuild the characters recipe
    Avatar.ForceUpdate(true, true, true); // Generate the mesh and texture
     
    hopeful likes this.
  6. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    Hi Jaimi, thanks a lot for your quick answer.
    In my first attempt I tried to use WardrobeCollections, however, I couldn't instantiate an UMAWardrobeCollection inside another script (I tried to create a randomized collection), it just requires me to depend on an associated SerializableObject, that I needed to configure manually beforehand, and that is not the most suitable approach for me. Nonetheless, I'm probably missing something. I will keep on studying the UMA DCS Classes.
    Thanks again!

    Edit: Found the bug... my randomized stuff was stored in a dictionary successfully filled in editor mode... and empty at runtime. Dictionary serialization issue, not related to UMA. My mistake! sorry to bother you, and thanks again!
    Edit2: Sorted out the whole dictionary issue by loading it OnAwake, but the problem persisted. The UMA Data Script showed me an incomplete warning telling me the assets i was trying to lead were nowhere to be found, or something similar.
     
    Last edited: May 21, 2017
  7. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    Hi everyone,
    I managed to solve my problem, so I share the solution.
    The problem was the LoadWardrobeSet() method has to be run from Update(), and not from Start(). I assume it has to do with UMA libraries updating on Start() too, so they were not fully updated when I was trying to run LoadWardrobeSet().
    To get it done I used the following hack:

    Code (CSharp):
    1.  
    2. private UMACharacterSystem.DynamicCharacterAvatar dca;
    3. private List<WardrobeSettings> outfit; //generated randomly from my wardrobe recipe library.
    4.  
    5. void Update ()
    6. {
    7.     if (Time.frameCount == 1)
    8.         {
    9.             dca.LoadWardrobeSet(outfit);
    10.             dca.BuildCharacter();
    11.             dca.ForceUpdate(true, true, true);
    12.         }
    13. }
    If it wasn't for Jaimi's help with the BuildCharacter and ForceUpdate suggestions, this wouln't have been possible, so thanks a lot Jaimi!
     
    hopeful likes this.
  8. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    I slightly better method might be to use a coroutine or to use Invoke with a delay, then you dont have to make a hack in the Update loop.
     
  9. telarin

    telarin

    Joined:
    May 1, 2017
    Posts:
    12
    I have a question that I'm hoping has a fairly easy answer. I've searched as best I can with the limited forum search functionality, as well as searching outside sites, but so far, have found no answer. I am working on a game using the stock FPSController from Standard Assets. I would like the player to be able to see arms and hands, as well as feet and torso if looking down far enough. I was hoping that attaching an UMA with no head to the FPS controller would be relatively straight-forward, but so far everything I have tried has failed.

    Attaching it directly to the FPSController or the FirstPersonCharacter camera under the FPSController does not seem to work. The UMA does not stay attached and has a tendency to just "fall off". I can watch the Y value for the UMA's position continue to decrease as if it is falling independent of the player/camera.

    I thought this might be because the UMA has it's own Rigidbody and Capsule Collider. I tried turning the Capsule Collider off, and setting the Rigidbody to Is Kinematic, but now receive a KeyNotFoundException whenever attempting to play in the editor.

    Is what I want to do even possible with UMA? If so, can anyone give me some pointers as to what I might be doing wrong? I'm quite new to UMA. I have watched through Secret Anorak's tutorials twice now, but they all seem to be pre DCA, so probably don't apply anyway.
     
  10. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    You need to attach the camera to a bone on the UMA, like the head bone. Keep in mind though that this will also make the camera jump around a lot since it will be following the animations around. A slightly better method would be to make sure the camera tracked the headbone instead so you can have some custom script to counter some of the movement.
     
  11. dudedude123

    dudedude123

    Joined:
    Aug 24, 2013
    Posts:
    128
    I keep getting this error: Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/pUMATextRecipe.cs(438,20): error CS0121: The call is ambiguous between the following methods or properties: `System.MissingExtensions.HasFlag(this System.Enum, System.Enum)' and `UMACharacterSystem.EnumExtensions.HasFlag(this System.Enum, System.Enum)'
     
  12. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    What version of Unity and what platform are you compiling for?

    Edit:

    It appears you have another extension in another package interfering. unfortunately a namespace won't solve this issue. One of the two will need to be deleted. The UMA one is in EnumExtensions.cs
     
  13. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    It can be solved quite easily by just changing that line from:
    HasFlag(
    to
    UMACharacterSystem.EnumExtensions.HasFlag(t
    Right?
     
  14. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Well, there's 27 lines that would need to be changed. But yeah, you could just call the function directly.

    edit: you'd have to change the function def, as it's an extension method too:

    public static bool HasFlag(this Enum self, Enum flag)

    you'd have to remove the "this".

    I recommend just deleting the file
     
  15. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Haha, ok
     
  16. dudedude123

    dudedude123

    Joined:
    Aug 24, 2013
    Posts:
    128
    I have the latest Unity and I'm compiling for Windows Store/Xbox I'm also using the Xbox Live Unity Plugin
     
    Last edited: May 24, 2017
  17. rossdp

    rossdp

    Joined:
    Apr 28, 2017
    Posts:
    19
    Hey guys, I'm having an issue trying to use UMA on multiple workstations. I've configured external source control, we are using Git with git-lfs enabled and the project is set to force text serialization of assets.

    On computer 1 (where the project was created) everything is working fine.

    On computer 2, which did a `git clone` of the repository, all of the files seem to be correct, however none of the UMA overlays are working.

    • I've confirmed that the overlay asset files are correct. They reference the GUIDs of the texture files.
    • The texture meta files are confirmed to be using the same GUIDs.
    • The texture files themselves do exist.

    For example I purchased/imported "Sci clothing pack vol.1" from the store. You can see here that "outfit 1" has a "pants and boots" overlay that references the "Pants boots_A.tga" texture. The GUIDs match on computer 2.

    ross@testr:~/game$ find . -type f -print0 | xargs -0n 20 grep '1e756e3fe94482748be8ac7b6192c00b'

    ./Assets/UMA/Content/Sci clothing pack vol.1/Outfit 1/Male/Overlays/Sci Pants and boots.asset: - {fileID: 2800000, guid: 1e756e3fe94482748be8ac7b6192c00b, type: 3}

    ./Assets/UMA/Content/Sci clothing pack vol.1/Outfit 1/Male/Textures/Pants boots_A.tga.meta:guid: 1e756e3fe94482748be8ac7b6192c00b

    Binary file ./Library/metadata/1e/1e756e3fe94482748be8ac7b6192c00b.info matches



    However, when I load up Unity, the editor shows me that there are NO textures associated with that overlay.

    Here is a screenshot: (Red X's to highlight the problem areas)



    Since all the GUIDs in the asset files seem to match up, I'm wondering if there is something special I need to do to get Unity and/or UMA to look for those textures, or reinitialize a cache, or something like that?

    Thanks in advance for any tips you can provide.
     
  18. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    At first I assumed this was a problem with the Global Library. But that doesn't appear to be the case (since it's actually finding the slots and overlays, just not the textures). if you pull up the overlay itself, does it show the textures there? I'm guessing it doesn't.
    So most likely case is that Unity & GIT somehow got out of sync, and it imported the overlays before it imported the textures, basically corrupting them. I think it would fix itself if you import the package manually on computer #2.

     
    hopeful likes this.
  19. rossdp

    rossdp

    Joined:
    Apr 28, 2017
    Posts:
    19
    It shows 3 textures, but they're all set to None:



    In the asset file, it shows 3 entries for textures that have GUIDs that correspond to the correct files:

    textureList:
    - {fileID: 2800000, guid: 1e756e3fe94482748be8ac7b6192c00b, type: 3}
    - {fileID: 2800000, guid: 5b9ec9245c8e0004c829b591bafbb307, type: 3}
    - {fileID: 2800000, guid: bab07e24630a2d948bf612ae279980b3, type: 3}


    I tried reimporting the package as you suggested, and that did indeed fix the problem.

    Interestingly, even if I totally revert all the changes back to the git version, discarding all the changes from the reimport, it still works after the reimport. It looks like it must be some sort of caching problem in Unity.

    The same problem happened with UMA Hair pack. None of the textures were showing up, though the GUIDs were all still matching. After reimporting, it is working fine, even after deleting all the files and reverting back to the previous git state.

    I see a "Reimport all" menu item in Unity, which when I click it says "Something must have broken in Unity, please submit a bug report." So I'm guessing that is what has happened.

    Thanks for your help. :)
     
    hopeful likes this.
  20. rossdp

    rossdp

    Joined:
    Apr 28, 2017
    Posts:
    19
    Ah ha! I figured it out.

    In case anyone else has trouble with this, the problem was that my Git UI was not correctly configured to execute UnityYAMLMerge. Command-line Git was working correctly, but UI Git was not.

    After fixing the configuration for my Git UI, I'm able to pull down updates and switch branches without a problem. (There are insane periods of time where it remaps all the texture files each time I switch branches, but that's a Unity problem, not a UMA problem).
     
  21. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Delete the file: EnumExtensions.cs
     
  22. dudedude123

    dudedude123

    Joined:
    Aug 24, 2013
    Posts:
    128
    I got another error: Assets/UMA/Core/Extensions/DynamicCharacterSystem/Scripts/UMADynamicCharacterAvatarRecipe.cs(38,25): error CS1061: Type `UMACharacterSystem.DynamicCharacterAvatar.SaveOptions' does not contain a definition for `HasFlag' and no extension method `HasFlag' of type `UMACharacterSystem.DynamicCharacterAvatar.SaveOptions' could be found. Are you missing `System' using directive? Should I take the "has flag code out of UMADynamicCharacterAvatarRecipe.cs?

    I think the Xbox Live SDK is interfering with UMA and I need both for my games.

    Edit: Never mind this reply, I fixed the problem
     
  23. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Well, this is going to be harder to fix then. You'll need to put back the enumextensions.cs file, and then rename the function to something else, like "HasBitSet" or something (instead of HasFlag). Then change all the "HasFlag" to something else.

    Can you search your project for any other "HasFlag" function? If it's in the xbox sdk, perhaps we should change our UMA version to something else.
     
  24. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Good deal. I went ahead and renamed the function in the next update (to HasFlagSet) in case others have the same issue.
     
  25. Deleted User

    Deleted User

    Guest

    I read here something about 2.5.1 and 2.6.. but the newest version is 2.5. Where to get the newest update? Why is it not on the asset store? And what has been added etc? Thanks.
     
  26. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Both of these haven't made it to the asset store yet. They're in github:

    https://github.com/umasteeringgroup/UMA

    2.51 is in master. It has the same features as 2.5, but also includes various fixes.

    2.6 is in uma26. It has several new features and additions:

    • Blendshapes for things like pointy ears
    • Tons of sanity checking and warnings for all the most frequent issues
    • Rag doll
    • New hair and clothing
    • Optional high poly meshes
    Plus lots of small convenience features and bug fixes.
     
    Deleted User, hopeful and Firlefanz73 like this.
  27. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Ragdoll sounds interesting, but I never used it. Will there be a demo Scene or something? :)
     
  28. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Yeah - there's a demo scene ("RagdollExample"). I think Kenan is the one who worked on this, so I can't answer detailed questions. But I believe you put a recipe on the DynamicCharacterAvatar ("PhysicsHDRecipe") in the Additional Recipes area, and then tell it to ragdoll itself:

    Code (CSharp):
    1.            
    2.      if (Input.GetMouseButtonDown(0))
    3.             {
    4.                 //Get a ray going from the camera through the mouse cursor
    5.                 Ray ray = currentCamera.ScreenPointToRay (new Vector3(Screen.width/2,Screen.height/2,0));
    6.                
    7.                 //check if the ray hits a physic collider
    8.                 RaycastHit hit; //a local variable that will receive the hit info from the Raycast call below
    9.                 if (Physics.Raycast(ray,out hit, 100f, layers))
    10.                 {
    11.                     //check if the raycast target has a rigid body (belongs to the ragdoll)
    12.                     if (hit.rigidbody!=null)
    13.                     {
    14.                         Transform avatar = hit.rigidbody.transform.root; // this need to search more intelligently, only works
    15.                         //find the RagdollHelper component and activate ragdolling
    16.                         UMAPhysicsAvatar player = avatar.GetComponent<UMAPhysicsAvatar>();
    17.                         if(player)
    18.                         {
    19.                             player.ragdolled=true;
    20.                         }
    21.                        
    22.                         //set the impact target to whatever the ray hit
    23.                         impactTarget = hit.rigidbody;
    24.                        
    25.                         //impact direction also according to the ray
    26.                         impact = ray.direction * 2.0f;
    27.                        
    28.                         //impactTarget.AddForce(impact,ForceMode.VelocityChange);
    29.                        
    30.                         //the impact will be reapplied for the next 100ms
    31.                         //to make the connected objects follow even though the simulated body joints
    32.                         //might stretch
    33.                         impactEndTime=Time.time+0.1f;
    34.                     }
    35.                 }
    36.             }
     
    hopeful and Firlefanz73 like this.
  29. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Yep, there's a radgoll example scene showing it off. There are two recipes that can be added to an avatar's additional Recipes list, "PhysicsStandardRecipe" and "PhysicsHDRecipe". They contain the scripts to hook up all the rigidbodies and colliders on the bones on the standard UMA rig. The difference between the two is the number of colliders used. These also tie in with using cloth, which is also added in this next update. Big credit goes to SecretAnorak for creating most of the ragdoll code.

    The blendshape support also has a "baking" feature, so after the blendshape value is set you can bake those vertex offsets to there is zero performance hit associated with the blendshapes. This also has a demo scene.
     
    Firlefanz73 likes this.
  30. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    That sounds great, thanks a lot kenamis and jaimi!
    I will wait for the next update and try to update my project then.
     
  31. rossdp

    rossdp

    Joined:
    Apr 28, 2017
    Posts:
    19
    Quick question about saving DCA recipes:

    I see DynamicCharacterAvatar.DoSave which looks like it cleans up some internal data before it serializes to JSON and synchronously writes a file.

    I also see DynamicCharacterAvatar.LoadFromRecipeString which takes a string and sets up a DCA.

    This seems counter-intuitive, because on the one hand it forces me to let it do all of the file writing, and on the other hand it forces me to do the file reading myself. It's quite possible I've missed something, and if so please advise.

    My goal is to be able to do something like SaveToRecipeString, which returns the serialized string to me directly instead of messing around with files, while preserving all of the clean up code that exists in DoSave, which seems important. I'll handle the saving/loading of the recipe text myself, and just pass the text to UMA. I don't want it messing with files but I do want it to be able to tell me what data needs to be saved.

    It seems like to do this, I need to modify the DynamicCharacterAvatar class.

    If that is the case, shall I just fork UMA on Github, make the change and submit a pull request? If so, from what branch should I fork?

    Thank you. :)
     
  32. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I think what you're wanting is "GetCurrentRecipe()" - this will return a string that you can save and then load using LoadFromRecipeString().

    Jaimi


     
    hopeful and rossdp like this.
  33. rossdp

    rossdp

    Joined:
    Apr 28, 2017
    Posts:
    19
    That does indeed look exactly like what I need. Thanks Jaimi. :)
     
  34. dudedude123

    dudedude123

    Joined:
    Aug 24, 2013
    Posts:
    128
    I got Character Customization with UMA 2.0 and I get this error:

    NullReferenceException: Object reference not set to an instance of an object
    OverlaysManagerClass.GetOverlayByName (System.String overlayName) (at Assets/CharacterCustomisationUMA2/Script/OverlaysManagerClass.cs:46)
    UIManager.InitSliderValue () (at Assets/CharacterCustomisationUMA2/Script/UIManager.cs:791)
    UIManager.Start () (at Assets/CharacterCustomisationUMA2/Script/UIManager.cs:236)

    I think the error comes from this code:

    public Overlays GetOverlayByName(string overlayName){
    Overlays overlayToReturn = null;
    for (int i = 0; i <overlaysManager.Length; i++){
    if(overlaysManager.overlay.overlayName == overlayName) {
    overlayToReturn = overlaysManager;
    }
    }
    return overlayToReturn;
    }
     
  35. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Overlays should be compatible between 2.0 and 2.5, so I'm not sure what is wrong.
    I think you'll need to contact the author of that asset: jocelyn.assets@gmail.com

     
  36. dudedude123

    dudedude123

    Joined:
    Aug 24, 2013
    Posts:
    128
    I did but she didn't reply back
     
  37. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Well, until he releases a new version that is compatible with 2.5, I can only recommend that you uninstall it for now, and use one of the existing scenes as a base. That asset doesn't use the wardrobe system, so it will be limited as to what it can do compared to all the new stuff.
     
  38. Firlefanz73

    Firlefanz73

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

    anybody experienced with UMADnaHumanoid and streamwriter?

    When creating a new char, I create a random UMADnaHumanoid. After that I want to save it.

    Code (CSharp):
    1.  
    2. private void SaveUmaDNA(ushort npcNumber, UMADnaHumanoid umaDna)
    3.     {
    4.         try
    5.         {
    6.             string nameNPC;
    7.             Directory.CreateDirectory(Globals.WorldPath);
    8.             if (string.IsNullOrEmpty(Globals.WorldPath))
    9.             {
    10.                 Debug.LogError("Worldpath is missing!");
    11.                 nameNPC = Application.dataPath + "/../Worlds/" + Globals.Playerdata.WorldName + "/" + npcNumber;
    12.             }
    13.             else
    14.                 nameNPC = Globals.WorldPath + "/" + npcNumber;
    15.             Stream stream = File.Open(nameNPC, FileMode.Create);
    16.             BinaryFormatter writer = new BinaryFormatter();
    17.             Debug.Log("Writing DNA");
    18.             writer.Serialize(stream, umaDna);
    19.             stream.Close();
    20.             Debug.Log("Write DNA finished");
    21.         }
    22.         catch (System.Exception ex)
    23.         {
    24.             Debug.LogError("Save DNA Error: " + ex.ToString());
    25.         }
    26.     }
    But it is only 17 Byte big, seems to be too small. When loading the dann in the next start, I get Errors like this:


    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00004] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:104
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00078] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:179
    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:136

    Is there any already working solution to save and load just the dna to a file?
    Or does anybody have an idea how I can save the dna?

    To complete this, here my loading which does not work with the saved data right now:

    Code (CSharp):
    1.     private UMADnaHumanoid LoadUmaDNA(ushort npcNumber)
    2.     {
    3.         try
    4.         {
    5.             UMADnaHumanoid umaDna = new UMADnaHumanoid();
    6.             string nameNPC;
    7.             if (string.IsNullOrEmpty(Globals.WorldPath))
    8.                 Globals.UpdateWorldPath();
    9.             nameNPC = Globals.WorldPath + @"/" + npcNumber;
    10.             Stream stream = File.Open(nameNPC, FileMode.Open);
    11.             BinaryFormatter reader = new BinaryFormatter();
    12.             Debug.Log("Loading DNA: " + nameNPC);
    13.             umaDna = (UMADnaHumanoid)reader.Deserialize(stream);
    14.             stream.Close();
    15.  
    16.             return umaDna;
    17.         }
    18.         catch (System.Exception ex)
    19.         {
    20.             Debug.LogError("Load UMADna Error: " + ex.ToString());
    21.             return new UMADnaHumanoid ();
    22.         }
    23.     }
    Thanks a lot! :)
     
    Last edited: May 29, 2017
  39. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    UMADNA isn't setup to serialize like that.

    If you are using DynamicCharacterAvatar, you can serialize it to string using the function "GetCurrentRecipe" to return the string (and then just write the string to a file using File.WriteAllText), and you can load the Avatar from a string by reading the file using File.ReadAllText to get the string, and using the LoadFromRecipeString() function on the Avatar.

    If you are not using a DynamicCharacterAvatar, you can get a UMATextRecipe from the UMAData, and save/restore that. There is a sample that shows how to do it in UMAAvatarLoadSaveMenuItems.cs - Check out SaveSelectedAvatarsText and LoadSelectedAvatarsText.
     
    Firlefanz73 likes this.
  40. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Thanks a lot Jaimi! I will try the second one when I am home :)
     
  41. Pomelo874

    Pomelo874

    Joined:
    May 31, 2017
    Posts:
    22
    I have created my own avatar already, start rigging work----:confused: lots of bones need to rig, and I can not find any of uma rig tutorial video on youtube, is there anything need to be noticed? Thanks a lot.
     
  42. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    There's not a lot of stuff on creating your own Avatars. However, there has been some work by several people on this, and you might want to join the slack channel as they're quite active.

    If you're rigging to the same skeleton as the existing Avatar, then you might want to consider doing a skin-wrap (3ds max) or "Transfer weights" (blender) after sizing the skeleton to match your avatar. The avatar source is available here:

    https://github.com/umasteeringgroup/content-pack

    that has FBX, Max and Blender files.
     
  43. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    this might help you too,
     
  44. dudedude123

    dudedude123

    Joined:
    Aug 24, 2013
    Posts:
    128
    How do I open the materialbuilder?
     
  45. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Thats a UMA 1.0 thing, you don't need that for 2.X. You can use the standard UMA Materials that ship with UMA 2.X without building anything special.
     
  46. Pomelo874

    Pomelo874

    Joined:
    May 31, 2017
    Posts:
    22
    Thanks a lot, may I have an invitation for the slack channel? My email is: troop@aliyun.com
     
    Last edited: Jun 1, 2017
  47. Pomelo874

    Pomelo874

    Joined:
    May 31, 2017
    Posts:
    22
    Thanks, if there is MAX version? I'm so dizzy with blender.....anyway, I will have a try on what @Jaimi says, hope everything works fine:rolleyes:
     
  48. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    I finally made a coroutine in which I used a while searching for the shader object at each loop and then yielding. When the object was found I assumed the UMA was properly loaded, so I executed LoadWardrobeSet() and the rest.
     
  49. dudedude123

    dudedude123

    Joined:
    Aug 24, 2013
    Posts:
    128
    Is there any way I can turn an FBX into a slot?
     
  50. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    The Slot Builder editor window will let you do just that. Keep in mind that your mesh needs to match the rig of the race's base mesh.