umasteeringgroup / UMA

Unity Multipurpose Avatar
MIT License
726 stars 167 forks source link

BuildCharacter weird behaviour with avatar DoLoad #362

Closed Arthur-Kenichi-Condino closed 3 months ago

Arthur-Kenichi-Condino commented 3 years ago

Describe the bug there's a bug or something that prevents me changing DNA by script (the values change but the character isn't updated): and BuildCharacter() needs to be called twice so the collider is updated correctly when CharacterComplete event is fired.

The character is saved to (and loaded from) a txt file.

Environment (please complete the following information):

To Reproduce Steps to reproduce the behavior: My scripts which interact with UMA are: https://github.com/Arthur-Kenichi-Condino/SolitudeV5/blob/homunculus/Assets/AKCondinoO/Characters/System/Character.cs where I use avatar DoLoad and DoSave, and dna setters and BuildCharacter function

and: https://github.com/Arthur-Kenichi-Condino/SolitudeV5/blob/homunculus/Assets/AKCondinoO/SimObject.cs where I created OnCharacterCompleted(UMAData umaData) to handle CharacterCompleted event and OnUMADataChanged() to get collider values; note that OnCharacterCompleted calls BuildCharacter again once, otherwise OnUMADataChanged gets wrong collider values

Expected behavior BuildCharacter should update the UMA character body correctly. It fails to update the body if the character was loaded from a txt file with file system mode. BuildCharacter only works if the file wasn't present at the beginning, when the editor play button is pressed, thus not allowing the call of avatar DoLoad function

Screenshots I don't know

Additional context I try to change all UMA data through script

Arthur-Kenichi-Condino commented 3 years ago

currently, I suspect setting recipeString while loading could be affecting next changes to the character. Does anyone know which files use recipeString so I can test:

        Debug.LogWarning("recipeString:"+recipeString);

...? :D

Arthur-Kenichi-Condino commented 3 years ago

I found the culprit is DynamicCharacterAvatar.DoLoad(), but I couldn't find a solution yet; if the code calls DoLoad() using a file system previous saved file (txt), BuildCharacter() will not update the UMA character body anymore if dna is set in code.

Jaimi commented 3 years ago

@Arthur-Kenichi-Condino -

We can probably diagnose this easier on the discord:

https://discord.gg/5b39djg

Are you trying to change the DNA inside the Completed event?

Arthur-Kenichi-Condino commented 3 years ago

Are you trying to change the DNA inside the Completed event? No, I change the DNA on Update, then I call BuildCharacter(); but the character doesn't change its body. It keeps the new DNA values but doesn't change the appearance. And DoSave() doesn't save the new values too. This only happens if DoLoad() is called.

in the Completed event I get the new collider values.

Jaimi commented 3 months ago

Closing. Old issue. Please reopen if reappears