Closed grillo78 closed 5 years ago
Your umadata and DNA is stale, you have to get it again after changing your race. or you can use the DNASetters, but you have to get them again also.
I change the script to this: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UMA; using UMA.CharacterSystem;
public class PlayerModelCreation : MonoBehaviour { public UMAData umaData; public DynamicUMADnaBase umaDna; public Slider headWidthSlider; public DynamicCharacterAvatar avatar; public bool isBoy = false;
// Use this for initialization
public void setUMAData()
{
umaData = avatar.umaData;
umaDna = (DynamicUMADnaBase)umaData.umaRecipe.dnaValues[0];
headWidthSlider.SetValueWithoutNotify(umaDna.GetValue(2));
}
public void setHeadWidth(float value)
{
umaDna.SetValue("headWidth", value);
umaData.Dirty(true, false, false);
}
public void changeGender()
{
if (isBoy)
{
isBoy = false;
avatar.ChangeRace("HumanFemaleHighPoly");
umaData = avatar.umaData;
umaDna = (DynamicUMADnaBase)umaData.umaRecipe.dnaValues[0];
}
else
{
isBoy = true;
avatar.ChangeRace("HumanMaleHighPoly");
umaData = avatar.umaData;
umaDna = (DynamicUMADnaBase)umaData.umaRecipe.dnaValues[0];
}
}
}
but the problem persist, I got this error
That doesn't do anything, because it hasn't been rebuilt yet. You need to wait for it to rebuild, and then do it. There are several events on the DCA that will help. You should look at CharacterDNAUpdated or CharacterCreated.
fixed, thx u
You're welcome
Describe the bug After change the race dna values doesn't change. Video showing the problem: https://youtu.be/2pM9Yg_TTDQ
Environment (please complete the following information):
Unity Version: 2019.1.0f2 Personal
UMA Version: 2.8.1
Platform Build (if not editor):
My C# Script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UMA; using UMA.CharacterSystem;
public class PlayerModelCreation : MonoBehaviour { public UMAData umaData; public DynamicUMADnaBase umaDna; public Slider headWidthSlider; public DynamicCharacterAvatar avatar; public bool isBoy = false;
}