Narrative design scripting reference
Reference for IConvaiNarrativeDesign, including section events, trigger invocation, speech injection, template keys, and async fetch methods.
Access the character API
ConvaiCharacter character = GetComponent<ConvaiCharacter>();
IConvaiNarrativeDesign narrative = character.NarrativeDesign;Properties
Property
Type
Description
Listen to section changes
private void OnEnable()
{
character.NarrativeDesign.OnSectionChanged += HandleSectionChanged;
character.NarrativeDesign.OnSectionDataReceived += HandleSectionData;
}
private void OnDisable()
{
character.NarrativeDesign.OnSectionChanged -= HandleSectionChanged;
character.NarrativeDesign.OnSectionDataReceived -= HandleSectionData;
}
private void HandleSectionChanged(string previousId, string newId)
{
Debug.Log($"Section: {previousId} → {newId}");
}
private void HandleSectionData(NarrativeSectionData data)
{
Debug.Log($"Section ID: {data.SectionId}");
// data.BehaviorTreeCode and data.BehaviorTreeConstants available here
}Events
Event
Signature
Description
Invoke triggers from code
Control character speech
Pattern
What the character does
Listen to trigger invocations
Field
Type
Description
Template keys via code
Fetch sections and triggers
Via the character API
Via the static fetcher
Field
Type
Description
Advanced runtime control
Reset controller state
Reconfigure ConvaiNarrativeDesignTrigger from code
Component relationships
Next steps
Narrative design usage examplesTroubleshoot narrative designLast updated
Was this helpful?