Initializing DynamicCharacterAvatar

Dustin
2 min readJul 29, 2019

--

This is a devlog to see if I can port the “Universal Multipurpose Avatar”(UMA) addon for Unity over to the Godot Engine. You can find Part 5 here.

The focus of this new Milestone will be seeing if I can get some part of an UMA to display. For now, the goal is DynamicCharacterAvatar(hereafter referred to as the DCA) to run it’s initialization. Unity calls “Start” automatically. So I wrote my code to call it in the _Ready function.

The first thing the object does is that it looks for all of the UMA configuration objects. In Unity, these things are added as part of the “UMA_DCS” prefab. I will have to disable that and initialize all those files manually. At first glance, I thought that would take me a week.

Initializations

I created an empty UMAContext and set DCA’s context object before calling start. Shockingly, this was enough for the initialization to run to completion. But that was because there wasn’t anything to load. So I’ve now added an empty Recipe. I can see that it runs more code to completion during initialization. But it’s still not much. I’m going to try and load a real recipe.

JSON

It looks like the DynamicCharacterAvatar starts by reading in a JSON asset file that describes the high level character. Inside the JSON is a string called “recipeString” which is another JSON string. That JSON string is used to instantiate a “UMAPackRecipe” object. The original code used a Unity function to do that. I replaced it with Newtonsoft.

Import Settings

I’m studying the method, “ImportSettingsCO”. The more I study it, the more I believe that it is a hub for all the important code.

I’ve made some changes to the method. I’ve disabled some network code inside it that was meant to download assets — My proof of concept will assume everything is downloaded. I’ve also undone it being called as a “CoRoutine” and changed it to return void instead of an IEnumerable function called directly.

It looks like the method is meant to load up the UmaData object. UmaData appears to be the object that actually contains all of the information that gets displayed. It contains an array of skinned mesh renders. I’ll be studying how “ImportSettingsCO” loads data into the UmaData object very carefully.

Conclusion

My next few updates will probably be extremely technical in nature as I document how the code executes. My next update, I hope to have the ImportSettingsCO function completely mapped out. Also, you can follow along my updates in the repository if interested.

--

--

Dustin

Software Engineer, Writer, and blogger who has a love-hate relationship with the Detroit Lions