Custom Result Parser

With Result Parser you can modify the Content Data after the node is processed but before the UI displays the data. This is helpful when you want to implement features like localization and variable parsing.

Before forwarding the Content Data to the UIManager, the Dialogue Manager runs the data through every parser in the project based on their compute order value.

To create a new result parser, create a new script and implement the IResultParser interface.

public class MyResultParser : IResultParser
{
    public int computeOrder => 2; // Higher value later it applies

    public void Parse(UIContentData content)
    {
        foreach(string key in content.Keys)
        {
            string val = content.Get<string>(key, string.Empty);
            if(string.IsNullOrEmpty(value)) continue;
            
            // Here comes the parsing logic.
            // modify the val variable as you need.

            content.Add(key, val, true);
        }
    }
}

After creating the new ResultParser the system automatically recognizes it.

Last updated

Was this helpful?