Ability Deserialization Issue

magique

Active member
I'm using Unity 2019.3.4f1 and the latest store version of Third Person Controller. I am getting very erratic results trying to use the Converse ability for Dialogue System. Although the bug does not appear to be in Converse itself, but rather the Serialization of abilities in general.

In stand-alone build the issue happens every time, but in editor mode it works in one scene, but not in another. I did extensive debugging and I see that AbilityStarted never gets called when I am having the issue. I traced it down to where it is Deserializing the ability starter in the following code:


C#:
                m_Starter = m_StarterData.DeserializeFields(MemberVisibility.Public) as AbilityStarter;

m_Starter in this case is assigned null so I dug deeper and I see that in the following code inside DeserializeFields:

C#:
var objType = UnityEngineUtility.GetType(m_ObjectType);

m_ObjectType is an empty string.

However, if I attach to Unity and re-create the Converse ability or even drag it to a different position in the list, it executes the Serialize function and assigns the correct m_ObjectType. but then when I execute the scene or build stand-alone, it thinks m_ObjectType is an empty string and refuses to deserialize the starter.
 
Can you follow this post so I can reproduce it within a fresh project? The demo scene uses an ability starter for the Use (Action 5) Item Ability and I haven't seen it being set to null.
 
I provided 1, 2, and 3.

For #4 it's complicated as it involves Dialogue System. However, I was able to see it in the Dialogue System UCC example integration scene. In that instance, I simply converted the example scene to third person using Tony's instructions. Then all I had to do was walk up to the NPC and initiate the conversation.

For #5, there are no errors reported. It simply does not run AbilityStarted.

However, it should be noted that Tony was not able to reproduce the issue with these same steps. And even in my own project it works in one scene, but not another, and fails in stand-alone 100%. Although it may work for you 100% in a new project as well. It's very mysterious.
 
I took the dialogue system example scene and built a player with it and it worked. I can definitely take a closer look at it if you're able to reliably reproduce it. The object type is stored by Unity's serialization system so that part doesn't require any deserialization using our serializer. What ability starter are you using?
 
Unfortunately, it can't be reliably reproduced. It works in my own scene in the editor, but not in DS UCC example scene in editor. And the same scene that works in editor doesn't work in stand-alone exe.

I'm not sure why you say it doesn't require any deserialization. It calls the DeserializeFields function. And the object type is serialized using your own Serialization script.

I agree that there might not be much you can do though considering how flaky this is acting. I was hoping that the issue might spark some information that could lead to a solution.
 
What ability starter are you using?

I'm not sure why you say it doesn't require any deserialization. It calls the DeserializeFields function. And the object type is serialized using your own Serialization script.
m_ObjectType is serialized by unity, which is then used to deserialize the starter type. m_ObjectType isn't serialized using the serialization class built into the character controller.
 
m_ObjectType isn't serialized using the serialization class built into the character controller.
It is from what I'm seeing. I attach to Unity during edit time and put a break point on the following line of code in Serialization.cs:

m_ObjectType = objType.ToString();

And every time you re-order the ability list or create a new item, it hits this breakpoint.
 
Yes - that's fine. The ability system uses the serialization so that's why you are hitting that line so often.

m_Starter = m_StarterData.DeserializeFields(MemberVisibility.Public) as AbilityStarter;
In most cases this will be null. It is only not null when you have set an ability starter (which is more of an advanced use case and isn't used within the dialogue system integration example):

 
I just wanted to post here and let you know that after upgrading to version 2.2, this issue went away.
 
Top