Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

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

  1. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,963
    You'd almost always do better to have the weapon be a separate prop, which you can handle in a variety of ways. For instance, if you have a specific weapon to use and you just want to have it disappear when not in use, you can use the UMA bone builder feature, attach the weapon to the UMA skeleton, and just turn the mesh renderer on the weapon on and off as needed.

    As for closing the character's hand, that would require an animation. That's standard procedure for Unity's mecanim humanoids.
     
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    2.8 includes a sample scene that shows how to equip a weapon. Typically, Closing the hand would be done with an animation on a separate layer. These are both not specific to UMA, so any tutorials or 3rd party utilities should work.
     
    hopeful likes this.
  3. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    And of course the danger of posting an old draft is that someone has already answered. :)
     
  4. Jschilz1

    Jschilz1

    Joined:
    Jul 18, 2016
    Posts:
    46
    Is there a Tutorial on Adding Cloth Items to UMAs and how to use the cloth formats that UMA provides. For example adding Sashes or capes, or Kilts??? that use Colliders and physics to look real

    I know Secret has THis Walkthrough http://umawiki.secretanorak.com/Cloth but i am having trouble wrapping my head around it, was hoping for something visual, Although i may just be tired lol.;)
     
    Last edited: Oct 16, 2018
  5. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    I think that's all there is at the moment. Maybe someone will chime in with a better answer. It may be helpful to look at the cloth robe demo scene, or willb's cape pack.

     
    Jschilz1 likes this.
  6. Flaviof

    Flaviof

    Joined:
    Dec 28, 2013
    Posts:
    19
    Anyone know how to make UMA work with Emerald AI?
     
  7. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,684
    You should be able to just use the Bone Builder tool and then set it up normally with Emerald AI after that.
     
  8. Flaviof

    Flaviof

    Joined:
    Dec 28, 2013
    Posts:
    19
    The avatar move but dont play the animation. I dont know what to do. I had change the rigs and the avatar play the animation just fine in inspector. But dont work in game.
     
  9. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,684
    I'll give it a try and see if I can get it working. Will let you know soon.
     
  10. Flaviof

    Flaviof

    Joined:
    Dec 28, 2013
    Posts:
    19
    Thanks man, lost all day on this.

    Can use UMA just fine with other assets and controllers, but Emerald cant manage the UMA animator controller.
     
  11. Flaviof

    Flaviof

    Joined:
    Dec 28, 2013
    Posts:
    19
  12. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,684
    Make sure your Animator is set to the correct controller in the DynamicCharacterAvatar component under Race Animation Controllers. It is normally set to Locomotion and not the one assigned by Emerald AI.
     
  13. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,684
    I got it to work by doing two thing. First, assigning the correct animation controller to the DynamicCharacterAvatar. Second, disabling the Emerald_AI script by default and attaching the following script to it.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class DelayedEnable : MonoBehaviour
    6. {
    7.  
    8.     private Emerald_AI _emeraldAI;
    9.  
    10.     // Use this for initialization
    11.     void Start()
    12.     {
    13.         StartCoroutine(Delay());
    14.     }
    15.  
    16.     private void Awake()
    17.     {
    18.         _emeraldAI = GetComponent<Emerald_AI>();
    19.     }
    20.  
    21.     IEnumerator Delay()
    22.     {
    23.         yield return new WaitForSeconds(2f);
    24.         _emeraldAI.enabled = true;
    25.     }
    26. }
    Without the script, Emerald was not getting the renderer for UMA probably because it wasn't initialized yet.
     
  14. Flaviof

    Flaviof

    Joined:
    Dec 28, 2013
    Posts:
    19
    Genius! Work!

    Man, i think i love you! Thanks a lot, will buy you a beer tonight and give to some random strange!
     
  15. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,684
    Make it a coke and you have a deal. ;)
     
  16. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    336
    It might be a bit better to subscribe to the CharacterCreated event and then enable emeraldAI in case you have lots of UMAs and a given one takes longer than 2 seconds from Start to Renderer creation.
     
    hopeful likes this.
  17. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,684
    Yep. I was thinking there might be some sort of event that could be handled, but I'm not a UMA expert. And the 2 seconds was just a stab in the dark. I'm sure it can easily be improved. But sometimes you just use what works and move on.

    [EDIT]
    So, to make it better, you can remove the DelayedEnable script and just add an event for CharacterCreated. Reference the character object and just call enable on the Emerald_AI component. Make sure it is disabled initially.
     
    Last edited: Oct 17, 2018
    Jaimi and kenamis like this.
  18. MortalMan

    MortalMan

    Joined:
    Nov 6, 2012
    Posts:
    24
    Does UMA have any other forums besides this one forum post? Searching through 146 pages of forum posts can be a bit tedious. Is there an official UMA website with a FAQ and forum?

    Are there any pretty dresses for UMA characters? I've been searching, but so far I haven't found anything super fancy.
     
  19. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    There is a slack channel, but it's not a knowledge base (if you want access, IM me or one of the other devs).

    There is a Wiki here: http://umawiki.secretanorak.com/Main_Page

    As well, feel free to ask questions here. We've been talking about breaking off a separate thread for the new releases, but no one has done it yet.

    As for dresses - I think there is only one modern female pack, and it's older (uses the older shaders). I think O3N has some coming for his race packs, though. If you step outside the box a bit, there are several dresses in packs that are medieval themed that might work from Willbgameart or Arteria3d.

    As well, it's actually not too hard to fit clothing to the UMA models - you can take the Morph3d or Fuse stuff and have working UMA clothing in a few minutes with the help of Blender.
    SecretAnorak has a complete tutorial (and even uses Fuse as a sample):

    http://secretanorak.com/uma-201-creating-content
     
    Last edited: Oct 18, 2018
  20. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    143
    Has anyone used Playmaker to load a character into the scene?
     
  21. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    I have not. But if you create a prefab of the character, you should be able to just instantiate it like you could any prefab.

    Here is a sample of how to create a customizable prefab:

    http://umawiki.secretanorak.com/Creating_a_customizable_prefab
     
  22. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    It looks like the Opsive controller is doing something in the Awake function. You'll need to disable it on the prefab, and then set the enabled property to true in the CharacterCreated event. This will give the UMA time to generate it's avatar before the Opsive controller starts up.
     
  23. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    143
    Okay, I'll see about disabling those components and re-enable once loaded.
     
  24. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,963
    I think in general dresses will be hard to find. That's because so many games are action games (no dresses), and a lot of times if you want a dress to look very nice, it requires working with a cloth system (or something similar). Take those two reasons together, and you see why characters are usually wearing form-fitting garments.

    However ... let me point out that if you have a game that involves night club dresses or whatever ... you can always model them yourself in Blender, which is free. Start with something simple and move stepwise to the more complex.
     
  25. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    143
    So I have managed to spawn a UMA TPC prefab into the scene but I have noticed 2 different errors dealing with the Avatar. I'm using Playmaker to create the GameObject into the scene.

    Without Avatar
    Code (CSharp):
    1. Error: The Animator Avatar on UMADynamicCharacterAvatar(Clone) (UnityEngine.GameObject) is not assigned. Please assign an avatar within the inspector.
    2. UnityEngine.Debug:LogError(Object)
    3. Opsive.ThirdPersonController.AnimatorMonitor:Awake() (at Assets/Third Person Controller/Scripts/Character/AnimatorMonitor.cs:101)
    4. UnityEngine.Object:Instantiate(GameObject, Vector3, Quaternion)
    5. HutongGames.PlayMaker.Actions.CreateObject:OnEnter() (at Assets/PlayMaker/Actions/GameObject/CreateObject.cs:95)
    6. HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:205)
    7. HutongGames.PlayMaker.FsmState:OnEnter() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:175)
    8. HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2767)
    9. HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2714)
    10. HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2642)
    11. HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2783)
    12. HutongGames.PlayMaker.Fsm:Update() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:1994)
    13. PlayMakerFSM:Update() (at C:/Projects/Playmaker_1.9.0/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:579)
    14.  
    With Avatar
    Code (CSharp):
    1. Destroying assets is not permitted to avoid data loss.
    2. If you really want to remove an asset use DestroyImmediate (theObject, true);
    3. UnityEngine.Object:Destroy(Object)
    4. UMA.UMAUtils:DestroySceneObject(Object) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAUtils.cs:89)
    5. UMA.UMAGeneratorBase:UpdateAvatar(UMAData) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBase.cs:198)
    6. UMA.UMAGeneratorBuiltin:UpdateUMABody(UMAData) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:371)
    7. UMA.UMAGeneratorBuiltin:HandleDirtyUpdate(UMAData) (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:242)
    8. UMA.UMAGeneratorBuiltin:OnDirtyUpdate() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:265)
    9. UMA.UMAGeneratorBuiltin:Work() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:132)
    10. UMA.UMAGeneratorBuiltin:Update() (at Assets/UMA/Core/StandardAssets/UMA/Scripts/UMAGeneratorBuiltin.cs:97)
     
  26. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    51
    Hello UMA crew !

    I'm trying to utilize MegaFiers' wrapping system on the clothing I'm utilizing for my UMAs.

    Here's a video so you can see the system included in the MegaFiers package:



    However please keep in mind that the tutorials are VERY outdated and do not reflect current workflow for the system. As a matter of fact the video shown is so old that it does not even reflect that the product supported skinned meshes at a certain point! (However they do state on it that they will bring this functionality in the future, which they did. Until they removed it after...).

    The system basically allows the clothing meshes to deform based on the blendshapes of the character they are "wrapped around". Unfortunately, ever since they (MegaFiers) updated their plugin (which simplifies the whole process) there was a major change which kinda makes it all harder for me. It turns out the new system does NOT want to work when trying to wrap a Skinned Mesh Renderer itself (something which was possible a few months ago with the previous version of the plugin).

    What I mean by this is that the clothing pieces now have to be "unskinned" from the bones of the UMA.

    As to why? I have no idea. It seems to me this system was almost made with the idea of complimenting libraries such as UMA - it just seems like a perfect match for " ' procedurally ' generated content". I have asked the developer of MegaFiers for some clarification as to whether we can get the previous functionality back, however on the meanwhile I would like to know if perhaps there is some way I could generate the clothing as I would normally do YET have it be unskinned from the mesh.

    Is there any possibility of doing so? I know I can separate the Mesh by indicating on the UMA Material to use a separate renderer, however I have yet to find an option to use a Simple Mesh Renderer instead of a Skinned. Naturally I can understand why this option wouldn't be present by default, it just seems to be "against" the way UMA works... but hey, given that MegaFiers probably won't allow me to work with Skinned Mesh Renderers anytime soon, I might as well ask.


    The other workaround I guess, would be to simply export the clothing separately without any skeleton and then instantiate it in realtime ontop of the character, and then performing the MegaFiers wrapping in realtime through some scripting - however this would mean that the clothing assets would not be optimized - which is something I'd like to avoid - besides it would also require to rework the clothing for all my assets which also would require a lot of hours of work.

    It's a shame really, that MegaFiers does no longer support Skinned Mesh Renderers to wrap like it used to - I really can't understand why the devs would have removed that option. It would make everything so much simpler.... :(
     
    Last edited: Oct 19, 2018
  27. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    The first one is the avatar being accessed by the controller before it is created - see the previous messages. Whatever is doing that needs to be activated by the CharacterCreated event.

    The second one isn't behaving as I expect. Can you explain how you are creating the object?


     
  28. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    The only way I can think of would be to bake the SkinnedMeshRenderer to a mesh, and then wrap the mesh. Then simply update the position of the vertexes on the original SkinnedMeshRenderer. Hopefully Unity and/or Megafiers doesn't mess with the order / number of the vertexes.
     
  29. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    51

    Yup; that does not sound ideal, it feels like it will cause massive performance drops if I use this with every character.

    Hopefully Chris from MegaFiers can fix this; if he eventually does I will update you guys - this system has potential, it really could save us UMA guys quite some time one day.


    EDIT: Ok. On second thoughts I decided I'm gonna give the whole BakeMesh thing a try to see if it can work, at least for the moment! Unfortunately, what I'm doing at the moment is: grabbing a reference to the skinned mesh renderer of the clothing piece, creating a GameObject and giving it both a Mesh Filter and Renderer. I then create a Mesh 'mesh' and use it in the following way:

    mySkinnedMeshRenderer.BakeMesh(mesh);

    Then, I'm assigning it (the 'mesh' ), as the mesh of the Mesh Renderer in the new object I have just created through script. I've also recalculated the bounds, normals and tangents of the mesh after assigning it to the Mesh Filter.

    Unfortunately as soon as I run my code, the Mesh Renderer acts in very weird ways, it not only does no longer occupy the space the Skinned Mesh Renderer** is occupying, but it also flickers when there's camera movement and sometimes sort of "teleports" to a single constant different position (also based on the angle of the camera). I am not really sure as to what is happening, here.

    1.png 2.png

    Any clues??? I'm sure that is no longer an UMA question however I'd rather ask here given the context of it. Thank you so much in advance guys!




    ** As a matter of fact, some weird behaviour can be observed on this picture, as if the Renderer and Filter were not interacting correctly:
    3.png
     
    Last edited: Oct 20, 2018
  30. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,324
    Hi I am just starting using the latest version of UMA, I upgraded from a previous 2.0 version. But if I scale the UMADynamicCharacterAvatar gameobject from (1,1,1) to say (10, 10, 10), the position of my character is way far off above the camera, and the animations rotate around so it's feet are not sticking to the ground like they should. Is there some way to solve this issue?

    I read in some previous comments one user said "I have used the Bone Builder, and then I have increased the Root scale." What is the bone build and how could I maybe use it too on my character? I'd just like to scale my character up to 10,10,10 basically.

    Thanks for any help.
     
  31. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    I'm having exactly the same issue
     
  32. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    Unity version? Is this happening in a build, or when you run in the editor?
     
  33. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,324
    Hey Guys,

    I know this isn't a scripting forum but could someone post some quick code on how to setup an UMA 2.7 character via code?

    I watched a lot of the Secret Anorak videos, and he uses sliders and listeners to modify his UMA characters during runtime via code. However, I would simply like to do it directly at the Start of the game (i.e. in the Start() or OnEnable() functions), but I can't seem to get it right.

    I think I'm mainly stuck on how to update the "dna" after I set the settings. For example, I set the height of the UMA character to a different height, but it doesn't update it at all during runtime.

    Here is my code so far, I don't know what I'm doing wrong:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UMA;
    5. using UMA.CharacterSystem;
    6.  
    7. public class UMA_Version2_InstanceCreator : MonoBehaviour {
    8.  
    9.     // Note**:  Currently this script is attached to a prefab as a component on each UMA dynamic character avatar that gets
    10.     // instantiated into the scene.  If I'm having trouble getting the UMA type reference (or using directives) to work, one
    11.     // thing I had to do was go into the Unity Editor preferences (Edit->Preferences->External Tools), and set the external script
    12.     // editor to use "Notepad".  Open a script to get Unity to recognize the solution files again, and then set it back
    13.     // to using Visual Studio again, and it should find the script directives/namespaces again.
    14.  
    15.  
    16.  
    17.  
    18.  
    19.     // UMA version 2.7 came with a "Getting Started" prefab gameobject, which has
    20.     // a "Dynamic Character Avatar" script component already on it.  Here is
    21.     // the type reference for that script.
    22.     public DynamicCharacterAvatar avatarScript;
    23.  
    24.  
    25.     // DNA dictionary
    26.     private Dictionary<string, DnaSetter> dna;
    27.  
    28.  
    29.     private bool doOnce1;
    30.  
    31.  
    32.  
    33.  
    34.  
    35.  
    36.  
    37.     // Apparently this function starts BEFORE the default Start() function.  So anything I need here
    38.     // needs to be referenced here as well.
    39.     private void OnEnable()
    40.     {
    41.         // Reference the default DynamicCharacterAvatar script that came with UMA version 2.7 (currently).
    42.         avatarScript = transform.GetComponent<DynamicCharacterAvatar>();
    43.  
    44.         avatarScript.CharacterUpdated.AddListener(Updated);
    45.         //avatarScript.CharacterDnaUpdated.AddListener(DnaUpdated);
    46.  
    47.         //this.AddListener(HeightChange);
    48.         //avatarScript.CharacterUpdated.AddListener(BellyChange);
    49.     }
    50.  
    51.  
    52.  
    53.  
    54.     private void OnDisable()
    55.     {
    56.         avatarScript.CharacterUpdated.RemoveListener(Updated);
    57.         avatarScript.CharacterDnaUpdated.RemoveListener(DnaUpdated);
    58.  
    59.         //avatarScript.CharacterUpdated.RemoveListener(HeightChange);
    60.         //avatarScript.CharacterUpdated.RemoveListener(BellyChange);
    61.     }
    62.  
    63.  
    64.  
    65.  
    66.  
    67.     // Use this for initialization
    68.     void Start () {
    69.  
    70.         // Reference the default DynamicCharacterAvatar script that came with UMA version 2.7 (currently).
    71.         //avatarScript = transform.GetComponent<DynamicCharacterAvatar>();
    72.  
    73.         /*float randomValue1 = Random.value;
    74.  
    75.         // Before referencing the UMA Data "DNA", choose which "race" I want this UMA character to be.
    76.         if (randomValue1 >= .5f)
    77.         {
    78.             avatarScript.ChangeRace("o3n Male");
    79.         }
    80.         else
    81.         {
    82.             avatarScript.ChangeRace("o3n Female");
    83.         }*/
    84.  
    85.  
    86.         //dna = avatarScript.GetDNA();
    87.  
    88.         //HeightChange(Random.value);
    89.         //BellyChange(Random.value);
    90.  
    91.  
    92.         //float randomValue1 = Random.value;
    93.  
    94.         //avatarScript.BuildCharacter(true);
    95.  
    96.         // After changing the race it should change the DNA along with it.  So now I should be able to access the DNA.  In the
    97.         // "Secret Anorak" tutorials on YouTube, it is stated that changing the race kind of sets the DNA "dirty", and so it needs to be
    98.         // updated.  But that was during runtime -- so that is something to watch out for if I have problems with this.
    99.         //dna = avatarScript.GetDNA();
    100.  
    101.  
    102.  
    103.         // Now that the "DNA" data should be accessed above, go ahead and change the DNA here if I want (many options).
    104.         // Change the height
    105.         // *Note that I'm assuming that most of the dna "slider" values are between 0.0 and 1.0.  All of the ones I've seen are this way,
    106.         // however if some are not between 0.0 and 1.0, I should use Random.Range instead of Random.value (if I'm randomizing settings).
    107.         //dna["Height"].Set(Random.value);
    108.         //dna["Belly"].Set(Random.value);
    109.  
    110.         //HeightChange();
    111.         //BellyChange();
    112.  
    113.  
    114.         // Per the YouTube tutorial, I must always "build character" after setting/changing the dna or other settings.
    115.         //avatarScript.BuildCharacter();
    116.  
    117.  
    118.         doOnce1 = true;
    119.  
    120.     }
    121.  
    122.     // Update is called once per frame
    123.     void Update () {
    124.        
    125.         if(doOnce1 == true)
    126.         {
    127.             float randomValue1 = Random.value;
    128.  
    129.             // Before referencing the UMA Data "DNA", choose which "race" I want this UMA character to be.
    130.             if (randomValue1 >= .5f)
    131.             {
    132.                 avatarScript.ChangeRace("o3n Male");
    133.             }
    134.             else
    135.             {
    136.                 avatarScript.ChangeRace("o3n Female");
    137.             }
    138.  
    139.  
    140.             //avatarScript.ForceUpdate(true, true, true);
    141.  
    142.  
    143.             HeightChange(Random.value);
    144.             BellyChange(Random.value);
    145.  
    146.             //avatarScript.ForceUpdate(true, false, false);
    147.  
    148.             doOnce1 = false;
    149.         }
    150.  
    151.  
    152.     }
    153.  
    154.  
    155.  
    156.  
    157.  
    158.  
    159.  
    160.  
    161.  
    162.  
    163.  
    164.  
    165.  
    166.  
    167.  
    168.     //  -------------------------------------------   FUNCTIONS   --------------------------------------------------------
    169.     void Updated (UMAData data)
    170.     {
    171.         /*float randomValue1 = Random.value;
    172.  
    173.         // Before referencing the UMA Data "DNA", choose which "race" I want this UMA character to be.
    174.         if (randomValue1 >= .5f)
    175.         {
    176.             avatarScript.ChangeRace("o3n Male");
    177.         }
    178.         else
    179.         {
    180.             avatarScript.ChangeRace("o3n Female");
    181.         }*/
    182.  
    183.  
    184.         dna = avatarScript.GetDNA();
    185.  
    186.  
    187.         //HeightChange(Random.value);
    188.         //BellyChange(Random.value);
    189.  
    190.         //HeightChange(Random.value);
    191.         //BellyChange(Random.value);
    192.  
    193.         Debug.Log("I'm running the UMA updated function");
    194.     }
    195.  
    196.  
    197.  
    198.     void DnaUpdated (UMAData data)
    199.     {
    200.         dna = avatarScript.GetDNA();
    201.     }
    202.  
    203.  
    204.  
    205.     public void HeightChange(float val)
    206.     {
    207.         //dna = avatarScript.GetDNA();
    208.  
    209.         dna["height"].Set(val);
    210.         avatarScript.BuildCharacter();
    211.     }
    212.  
    213.     public void BellyChange(float val)
    214.     {
    215.         //dna = avatarScript.GetDNA();
    216.  
    217.         dna["belly"].Set(val);
    218.         avatarScript.BuildCharacter();
    219.     }
    220.  
    221. }



    Essentially, how do I modify and update the dna settings without getting null references or missing generator/recipe errors?

    Thanks for any help.
     
  34. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    2018.2.8f1
    Hapens only when running the game in the editor

    I think this is the relevant part

    UMAUtils.cs

    Code (CSharp):
    1.         public static void DestroySceneObject(UnityEngine.Object obj)
    2.         {
    3. #if UNITY_EDITOR
    4.             if (Application.isPlaying)
    5.             {
    6.                 UnityEngine.Object.Destroy(obj);
    7.             }
    8.             else
    9.             {
    10.                 UnityEngine.Object.DestroyImmediate(obj, false);
    11.             }
    12. #else
    13.             UnityEngine.Object.Destroy(obj);
    14. #endif
    15.         }
     
  35. A425

    A425

    Joined:
    Jun 27, 2014
    Posts:
    4
    Is there any tutorials or examples about equip weapons?
     
  36. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,963
  37. A425

    A425

    Joined:
    Jun 27, 2014
    Posts:
    4
    hopeful likes this.
  38. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    I created a prefab - placed it in the scene, ran the scene with no issues. We must be doing something differently. How is the character being created?

     
  39. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    Please note what the other user said before, he states it happens only when you add an avatar.
    I haven't checked it myself tho.
     
  40. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    There are a bunch of different ways that the Avatar can be added to the scene. It could be in there as part of the scene, it could be instantiated as a prefab. It could be instantiated and loaded from a file. It could be done in events.

    It sounds like it's trying to delete the actual avatar from the prefab (instead of the instantiation of the prefab). So I need to know how it's being created.

    The very simplest - the prefab is part of the scene - I've tested and it works fine. So I need more information on how to duplicate this if we have any hope of fixing it.
     
  41. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    51


    Hello!


    So after digging in deeper into the issues I can confirm my code works as expected when not utilizing it on the UMA Renderers generated at runtime.


    Utilizing the script that I described above on the .blend file of my character works just fine, none of the crazy weird behaviors mentioned above occur. They only occur when I try to run the script on the Mesh that has been generated by UMA.

    I am however (naturally) only able to utilize the script on the UMAs at runtime, while with the .blend file I can do this while in the Editor by calling a function before runtime (which seems to work fine and generates a Mesh Renderer from the Skinned Mesh Renderer provided by the .blend file that is both in place and does not flicker like the UMA Renderer does).

    so perhaps it has something to do with the animator?


    Thank you in advance for all of your help!
     
  42. Flegy

    Flegy

    Joined:
    Jan 5, 2017
    Posts:
    27
    Is possible use DNA after creating Dynamic Character Avatar without using listener?

    Code (CSharp):
    1. npcDNA = npcAvatar.GetDNA();
    2. npcDNA["height"].Set(1f);
    3. npcAvatar.umaData.ApplyDNA();
    it doesnt change DNA in my example.
     
  43. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    npcAvatar.GetDNA();
    npcDNA["height"].Set(1f);
    npcAvatar.ForceUpdate(true);
     
  44. Flegy

    Flegy

    Joined:
    Jan 5, 2017
    Posts:
    27
    Thanks @Jaimi

    Already tried with ForceUpdate. When I look at UMA Data on inspector it doesn't change Height and no error. When I make an update using npcAvatar.CharacterUpdated.AddListener(UpdateDNA); than work fine. Are have the direct way to use without a listener or it is the only option?
     
  45. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895
    The problem you are seeing is because you are trying to update the DNA before it exists. The Avatar and DNA don't exist until you have called BuildCharacter (or it's been called automatically).

    If you want to modify the DNA, you should be able to do this in the CharacterBegun event.

     
  46. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,895

    If you are manually calling BuildCharacter, you can change the DNA after it has been called the first time -- this has to be during the same frame, so it's safe if you do this:

    Avatar.BuildCharacter();
    // set all my dna here
    return;

    Otherwise, the only solution is to do it in an event.

    edit:

    You can disable automatic calling of BuildCharacter in the Advanced Options on the DynamicCharacterAvatar. Then you can call it yourself in a different script. But you have to be sure that you have done so after the DynamicCharacterAvatar script has initilized.
     
  47. Jschilz1

    Jschilz1

    Joined:
    Jul 18, 2016
    Posts:
    46
    @Jaimi or any one else that is capable of Helping me.

    At this point ive determined i am about as big of an idiot when it comes to UMA Hair, I fail to grasp the most basic of concepts. That being said can anyone please break it down for a Toddler or an Idiot Noob like me.

    I understand how to bring in clothes and make clothes and get them added into the slots but im not sure if my issues are in the Modeling side or the slot creations of the hair.

    IF anyone can make a basic breakdown of what is needed to bring into my project from The texture and Model and how to properly assemble it. This is the one Item of UMA that has completely eluded me at every turn, every time i think i figure it out i find out im just stupid :)

    Thanks in advanced and i will owe you all one big one
    James
     
  48. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,963
    I've seen your posts, but I don't understand what the problem is or what causes it. Hair is just a slot. Maybe you are trying to use a different material or something and that is causing your problems?

    If you can add default hair to your character, but not your own self-authored hair, then it has to be something in your setting when you export / import the hair. But for regular hair (a mesh, like any other slot), it should be the same process as for a regular slot.
     
    Last edited: Oct 22, 2018
  49. EnriquePage91

    EnriquePage91

    Joined:
    Jul 2, 2015
    Posts:
    51



    Sorry to be persistent guys but I've noticed a few posts from other people (published after my two posts) are getting help on their problems. Am I perhaps in a situation where no one really knows what can be done about my issue and therefore not getting any replies on the matter? Or hopefully someone can offer help, but they just haven't noticed my posts since the original one. I would really appreciate some help on this matter.

    Otherwise, if my case seems a bit difficult and I can get a "no idea' or a 'it probably will be harder than you think" from the usual life savers we see on this forum then I'll move on to some other idea! Once again sorry to be persistent, but I just find myself wondering if pursuing this idea of using MegaFiers Wrap System & UMA will be doable or not, as I need to have a demo by the end of the week.

    Thank you in advance for all the help guys and I wish you all the best in your developer adventures!
     
  50. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    4,963
    Possibly no one understands exactly the problem you are having, and we are hoping someone else does and can help. I, personally, have no idea.

    UMA works fine almost all the time. Bugs at this point are mainly with new features. When you start adding in something from the outside, which you were inquiring about at one point, then you need the advice of someone who has both and is using both. So if you are having trouble using Mega-Fiers with UMA, you probably have shrunk your help pool considerably. Maybe there is no one here who is using Mega-Fiers with UMA.

    Your chances of finding someone on the Mega-Fiers thread who uses UMA are probably greater.
     
    EnriquePage91 likes this.