Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

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

  1. frankmat

    frankmat

    Joined:
    Sep 14, 2013
    Posts:
    42
    Ok... thanks for the direction :)
     
  2. jrhee

    jrhee

    Joined:
    Dec 5, 2013
    Posts:
    72
    When I export a test build with three identical UMAs, I'm noticing the last one that gets generated "loses" its texture:

    upload_2016-4-26_13-43-5.png

    The problem only seems to occur in fullscreen mode (I'm testing on a Mac). All three UMAs appear correctly both in the editor and in windowed mode. I do see the missing texture shown on the character for the first frame or so before it goes black. I don't see any exceptions in the logs.

    Has anyone seen this before or have any suggestions on where I might start troubleshooting?
     
  3. seanrod

    seanrod

    Joined:
    Jan 13, 2015
    Posts:
    52
    So the answer was in the export settings. I'm using Maya 2012. I put all my clothes into on files. The Shirt and hat exported fine. However, when exporting the pants, there is something in the UMA model/rig that is setting the FBX export Unit setting to centimeters. If I set the FBX export units to "Meters", the pants export with the correct Scale Factor and File Scale of 1.
     
    hopeful likes this.
  4. seanrod

    seanrod

    Joined:
    Jan 13, 2015
    Posts:
    52
    Hey Secret Anorak, I saw in your UMA asset creation video 1 that you had Maya LT on your desktop. Have you tried to create pants slots exported from the Male_Separated.FBX in Maya? I can not create a pant_slot, however I can create slots for hats, shirts and even "shorts."

    All the FBX's come into Unity with a Scale Factor of 1 and a File Scale of 1.
    There is something the Pants.FBX that Unity or the "UMA Slot Builder" tool does not like. When I plug in the information into the slot builder and press the "Create Slot" button, I can not seem to generate a pants_slot in the slot folder.
     
    Last edited: Apr 28, 2016
  5. seanrod

    seanrod

    Joined:
    Jan 13, 2015
    Posts:
    52
    Sorry for the previous post, I figured out how to get the pant_slots.
     
  6. SecretAnorak

    SecretAnorak

    Joined:
    Mar 19, 2014
    Posts:
    172
    Hi @seanrod

    I've only just started using Maya LT, an am quite amazed how much easier it is to use with UMA than 3ds Max. So many hoops that you don't have to jump through, as long as you get your scaling right, most of the process just works.

    Glad you fixed it.
     
    Teila likes this.
  7. Waka-Takaki

    Waka-Takaki

    Joined:
    Jan 19, 2014
    Posts:
    7
    I'm trying to implement ragdoll physics with a UMA and read on a post that I should add the ragdoll components to the race so that they will be added as components when the UMA is generated, but I'm struggling. I've tried updating the HumanMale prefab with ragdoll components, which works if I drag the prefab directly to the scene, but when the UMA is generated the HumanMale race doesn't generate with the new components. I tried following a tutorial to create a new race to use my new prefab, but it looks like they removed the prefab section from the "create race" inspector window. Do you know how I can update a race to use my new HumanMale prefab in UMA2.0?
     
  8. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    627
    UMA2 doesn't use the race prefabs any more. There are various callbacks during the creation process that you can hook into and add the rag doll after the necessary skeleton components have been built. If you search in the project for "AdditionalSlots" there are some examples of adding elements such as a capsule collider as part of the new build process.
     
  9. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,037
    Let me add that if anyone ever does add ragdoll functionality using the Additional Slots feature, it would be a good idea to share that by having it added to UMA2 on github.
     
  10. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,311
    Is there a more separated version of the separated base body slots? For example one that separates out arms and legs rather than just "upper torso" and "lower torso". If this was standardized some how it would make it easier to use clothing or armor with short sleeves or a lower neckline, etc.
     
    Moerk75 and hopeful like this.
  11. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,037
    Nope, there isn't one, but IIRC Fernando ended up doing something like that on the personal project he was working on. (Though his version was more complicated, I gather.)

    A standard for doing that would probably be welcome. You might look at what Fernando did (there is a post / picture of it somewhere, a few pages back), and it might be good to consult with an UMA artist like Will B (@justb), for practical insight on where to cut.

    UPDATE: Here's the picture from Fernando that is worth a thousand words ....

     
    Last edited: May 1, 2016
    makeshiftwings likes this.
  12. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    Hi, so I am currently using the sample scene character creation that loads dynamically with sliders. I have a server and scripts to save/load to MySQL/php. I am trying to find where to get the string or code so I can upload the characters to the database then pull it. Does anyone have a example? :)
     
  13. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,311
    Yes, that picture is exactly what I was envisioning. Though personally I would probably separate the upper legs from the lower torso, since most clothing/armor will cover the crotch but might leave the thighs exposed, like swimsuits, skirts, etc. Similarly I'd split the upper torso into chest/midriff, for clothing with lower necklines or exposed midriff.
     
    hopeful likes this.
  14. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,037
    Networking has also been a sticking point for some UMA users, so if you get your issue resolved, consider either adding to the UMA2 on github or adding some notes to the wiki. ;)
     
  15. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    Will do but I will be able to network if I knew where the string was for characters.
    I have a framework that can load a uma character, then I'm using forge for networking.
     
    hopeful likes this.
  16. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    Did you check this?

    Have not looked at it myself but might be of use.
     
  17. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    Current error from video:

    code:
    using UnityEngine;
    using UnityEngine.UI;
    using System.Collections;
    using System.Collections.Generic;
    using UMA;
    using System.IO;


    public class Charstring : MonoBehaviour {
    public UMAData umaData;
    private UMADnaHumanoid umaDna;
    private UMACrowd crowdHandle;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {

    }
    /////////////////Load and Save ////////////////////////
    void Save() {
    //Generate UMA String
    UMATextRecipe recipe = ScriptableObject.CreateInstance<UMATextRecipe> ();
    recipe.Save (UMADynamicAvatar.UMAData.umaRecipe, UMADynamicAvatar.context);
    SaveString = recipe.recipeString;
    Destroy (recipe);

    //Save String to Text file
    string filename = "assets/char.txt";
    StreamWriter stream = File.CreateText (filename);
    stream.WriteLine (SaveString);
    stream.Close ();
    }


    }

    Theres a couple things it doesnt find like UMAData ect. Kinda weird. I could just follow the tutorial and create a whole separate UMA system. I was hoping to use the prebuilt though for now and try to get everything functioning .
     
  18. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    5,011
    You have a typo. it's umaData, not UMAData. If you look at UMADynamicAvatar, you can see it derives from UMAAvatarBase, and the public variables are right at the top.
     
    hopeful likes this.
  19. frankmat

    frankmat

    Joined:
    Sep 14, 2013
    Posts:
    42
    Agreed!!! I've spent full 2 days trying to get it working... and I've given up. There is not a single tutorial out there or demo project that shows you how to get UMA onto Networking. Surely it can't be that hard :(

    I've had 2 people ask me in private message... hoping I'd figured it out... which I haven't. So obviously lots of people are suffering in silence and giving up on it!
     
  20. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    Networking with UMA are super simple!
    As long as you can manage to get the saved recipe string from your character, its just a matter of sending that one over the network using RPC to all clients who then use it to instantiate their own copy of the UMA character.
    I use an empty GameObject as the "player" with a script on it that when "OnStartLocalPlayer" is called it send a Command with the recipie, that in turn sends a Rpc to all clients that then recreates the Uma and attaches that to the empty GameObject. That way i dont have to bother with player authority either since its attached to the GameObject that counts as "the player object"
     
  21. Waka-Takaki

    Waka-Takaki

    Joined:
    Jan 19, 2014
    Posts:
    7
    Thanks for the advice that's really helpful. I've starting manually creating a ragdoll in a new SlotDataAsset that is beeing applied to my UMA. I'm currently trying to get the sizes of the limbs for scaling my colliders. Does UMA store the length of the rig's bones anywhere? I can get some info from the uma humanoid dna (such as armWidth and stuff) but I'm looking to get thighLength etc. as that will allow the ragdoll to scale with the UMA.

    Anyone have any idea how Unity's inbuilt ragdollwizard gets the lengths etc? using renderer.bounds?
     
  22. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    You can join the UMA slack if you want, might make it easier to have a place to discuss things. Just pm me your email and i can add you.
     
    Teila likes this.
  23. frankmat

    frankmat

    Joined:
    Sep 14, 2013
    Posts:
    42
    Hi Virror,

    This is where I get confused. I am using the Unity "Network Manager" component... what I can't figure out is how to instantiate it on the Network. In the past I would instantiate it via the "Auto Create Player" using a prefab.

    With UMA though... you obviously can't. So are you sayig you create the UMA dynamically via the "OnStartLocalPlayer" and then send an RPC call to the other users to also instantiate a new UMA with the recipe you send over?
     
  24. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    Yes, i just place an empty GameObject as the player prefab and let the manager spawn that. Then "OnStartLocalPlayer" will only fire for the client who owns that player, and that function can then send the recipe to all the other clients using a Command and a Rpc, and then all clients can rebuild the UMA locally.
     
    frankmat likes this.
  25. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    Quick question regarding race creation. When transfering the UMA default rig to a new race, should the skin weights retained or can they be modified without breaking anything?
     
  26. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    627
    It does generate a HumanDescription while building a new avatar which might possibly be useful. http://docs.unity3d.com/ScriptReference/HumanDescription.html

    At some point I added the basic requirement that the DNA be able to provide a size and mass for the character so that's another possibility, although that's probably too much to require from the DNA and going straight to the skeleton might be simpler. The avatar provides a "safe" way of finding the various Mecanim bones you'd want.
     
  27. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    NOTE: This package is built using Unity 5.3.4
    Here is a Complete demo scene demonstrating how to use UMA with a networked game.

    http://www.penandpaperrpg.one/Downloads/UMA_Network_Example.unitypackage
    You need to have UMA 2 imported for this to work of course!

    Hope it will help you guys/girls out there who is trying to combine UMA and networking.
    This will be added "officially" later on but putting it here for now, enjoy! : )
     
    Last edited: May 2, 2016
    frankmat, Spice9, UnLogick and 2 others like this.
  28. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    I fixed it but I still am getting these errors.

    Same code just fixed the umaData
     
  29. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.UI.Graphic.OnRebuildRequested () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Graphic.cs:480)
    UnityEngine.UI.Text.OnRebuildRequested () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Text.cs:550)
    UnityEngine.UI.GraphicRebuildTracker.OnRebuildRequested () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/GraphicRebuildTracker.cs:33)
    UnityEngine.CanvasRenderer.RequestRefresh () (at C:/buildslave/unity/build/artifacts/generated/common/modules/UI/CanvasRendererBindings.gen.cs:314)

    What I got when I tried using the scene's.
     
  30. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    5,011
    You're using the classes, when you should be using an object instance.
    Code (csharp):
    1.  
    2. recipe.Save (UMADynamicAvatar.UMAData.umaRecipe, UMADynamicAvatar.context);
    3.  
    In this case, you can't use "UMADynamicAvatar" because that is the class. You need an instance of the class.
    You need to use the instance of the UMADynamicAvatar that you want to save.
     
  31. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    What Unity version are you using? This package is build using 5.3.4, so might be that?
     
  32. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    Current version on asset store.
     
  33. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    No, Unity version, not UMA version.
     
  34. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    Sorry read that wrong 5.3.4f1
     
  35. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    Thats strange, the errors indicate that there are some issues with the gui, not with my scripts, will investigate...
     
  36. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    Try removing the Text object from the canvas and see if that does anything.
    Just tried this again with a fresh project with the UMA from the store and had no issues : /

    Watching your screen, it clearly states there are some issue with the Text object, which is really strange, i think it must be some kind of import error.
     
  37. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    I reimported it and it worked... Not sure what was wrong with that first import.
     
  38. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    Great! : )
     
  39. frankmat

    frankmat

    Joined:
    Sep 14, 2013
    Posts:
    42
    Thank you thank you thank you! I will give it a go tonight. :)
     
    hopeful likes this.
  40. DittleChristi

    DittleChristi

    Joined:
    May 4, 2016
    Posts:
    1
    Hello I'm learning UMA 2. I watched the SecretAnorak videos, which are cool. I'm a little confused how to get an UMA txt that a user will configure to a networked game.

    So the user moves the slider to create a avatar shape.
    The user then saves the data somehow.
    How does this text file get passed to a game so the user can see the avatar?
     
  41. Spice9

    Spice9

    Joined:
    Jan 3, 2016
    Posts:
    16
    I am working on that right now with Virror who has been a HUGE help.
    I will let you know once I get it working (works with scene 1 unity example trying to get it to work with Scene 5)
    And I will share what I have as far as getting it to work :)
     
    hopeful likes this.
  42. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    See the example scene i posted earlier on this page : )
     
  43. NoobTaco

    NoobTaco

    Joined:
    Mar 24, 2015
    Posts:
    18
    [EDIT]: Everything is working now. It seems, as with most things, it was operators error. I was trying to feed the string from the database to the wrong place it would seem. Once I went over my code again I was able to get it to work.

    The only odd thing that I have given up on now is even the replace methods would not rip out those escape characters. . Oh well..

    THANKS to everyone that tried to help!!

    --------------

    Hello everyone.

    I am working on a character customization app where I am saving the UMA Recipe to SQLite. I have had great luck exporting it to the database but I am having issues importing it back into the game from the database. The JSON string is filled with extra escape codes that is causing it to fail.

    Here is my save and load script so far.

    Code (CSharp):
    1. public void Save()
    2.     {
    3.         // Generate UMA String
    4.         UMATextRecipe recipe = ScriptableObject.CreateInstance<UMATextRecipe>();
    5.         recipe.Save(umaDynamicAvatar.umaData.umaRecipe, umaDynamicAvatar.context);
    6.         SaveString = recipe.recipeString;
    7.         Destroy(recipe);
    8.  
    9.         // Get the charactername for the file name
    10.         string umaName = characterName.text.ToString();
    11.  
    12.         if (umaName == "")
    13.         {
    14.             // TODO - Add Error message
    15.             Debug.Log("Need a character name");
    16.             return;
    17.         }
    18.  
    19.         var dbPath = string.Format(Application.dataPath + "/StreamingAssets/" + databaseName);
    20.  
    21.         // Check to see if database exists
    22.         //var ds = new DataService(databaseName);
    23.         if (!File.Exists(dbPath))
    24.         {
    25.             _connection = new SQLiteConnection(dbPath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create);
    26.             Debug.Log("Final PATH: " + dbPath);
    27.  
    28.             _connection.DropTable<CharacterRecipe>();
    29.             _connection.CreateTable<CharacterRecipe>();
    30.         }
    31.  
    32.         _connection = new SQLiteConnection(dbPath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create);
    33.         Debug.Log("Final PATH: " + dbPath);
    34.  
    35.         // Prepare the sql insert call
    36.         var ds = new DataService(databaseName);
    37.         var p = new CharacterRecipe
    38.         {
    39.             umaName = umaName,
    40.             umaRecipe = recipe.recipeString,
    41.         };
    42.  
    43.         // Insert the recipe into the database
    44.         _connection.Insert(p);
    45.     }
    The save function is working.

    Code (CSharp):
    1.     public void Load()
    2.     {
    3.         //TODO Add destroy uma
    4.  
    5.         var dbPath = string.Format(databaseName);
    6.         var ds = new DataService(dbPath);
    7.  
    8.         var umaRecipe = ds.GetRecipe();
    9.         //string characterFileName = EventSystem.current.currentSelectedGameObject.name;
    10.         string characterName = EventSystem.current.currentSelectedGameObject.GetComponentInChildren<Text>().text;
    11.  
    12.         var LoadString = ds.GetUmaRecipe(characterName);
    13.         foreach (var umaName in LoadString)
    14.         {
    15.             Debug.Log(umaName.umaId);
    16.             Debug.Log(umaName.umaName);
    17.             Debug.Log(umaName.umaRecipe);
    18.  
    19.             //Regenerate UMA using string
    20.             UMATextRecipe recipe = ScriptableObject.CreateInstance<UMATextRecipe>();
    21.             recipe.recipeString = umaName.umaRecipe;
    22.             umaDynamicAvatar.Load(recipe);
    23.             Destroy(recipe);
    24.         }
    25.     }
    The JSON looks fine in the DB but is returning this

    I am sure I am missing something simple. Any tips would be greatly appreciated.

    Thanks.
     
    Last edited: May 8, 2016
  44. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    I think you need to look into how you fetch the string from the DB.
    Im doing exactly this with php and mySQL and have no issues, so the issue is most likely the actual read from the DB.
    Hard to say without knowing anything about the DB interface.
     
    hopeful likes this.
  45. NoobTaco

    NoobTaco

    Joined:
    Mar 24, 2015
    Posts:
    18
    More than likely. I am using https://github.com/codecoding/SQLite4Unity3d as my SQLite wrapper. I just hope someone knows off hand. But I am still looking into it.

    Thanks @virror
     
  46. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,626
    Clearly your string is retrieved from sql different that what you passed to it, making it a bug in the SQLLite wrapper. The string is escaped and the SQLLite should have a method to unescape it, if you can't find that try simply as replacing \" with " it just might work.
     
  47. NoobTaco

    NoobTaco

    Joined:
    Mar 24, 2015
    Posts:
    18
    Thanks @UnLogick I have been trying all morning to trace that down as well as tried MULTIPLE ways to replace the escape characters. It keeps sticking and is frustrating to no end.

    Here all the methods I have tried so far.

    Code (CSharp):
    1. string JsonContentFixed = umaDB.umaRecipe;
    2.             string JsonStriped = JsonContentFixed.Replace('\"', '"');
    3.             string JsonStripedTwo = Regex.Replace(JsonContentFixed, @"\\", "");
    4.             string JsonStripedThree = Regex.Unescape(JsonContentFixed);
    And each one still has the extra escape codes in it.

    I know its probably simple but man I am getting frustrated.

    Thanks for letting me bounce it off you guys.
     
  48. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    That does dont seem to be the correct codes you are trying to remove? Try removing "\r" and "\n".
     
  49. NoobTaco

    NoobTaco

    Joined:
    Mar 24, 2015
    Posts:
    18
    Thanks for the tip, however still no joy.

    What I am trying to remove is this

    Code (csharp):
    1. "{\"version\":2,\"packedSlotDataList\":null,\"slotsV2\":[{\"id\":\"MaleEyes\"
    The \" needs to be replaced with just a "

    This does not make any sense. The replace commands should work.

    Thanks again for trying to help @virror
     
  50. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,961
    Im not 100% sure the \" are just \", i dont think the log can display escape characters like newline or carriage return. You might want to try and convert the first few bytes to a byte array or something just to verify exactly what its doing.
     
unityunity