Troubleshooting
A complete guide to diagnosing and resolving errors in the StoryFlow Unity plugin. Covers error messages, common pitfalls, and debugging strategies.
Errors Are Non-Fatal
StoryFlow errors do not crash your game. When an error occurs, the runtime stops processing the current node chain and fires the OnError event. Dialogue execution may end or stall, but your game continues running. This lets you handle errors gracefully in your UI.
Common Errors
The following table lists the most common error messages you may encounter, along with their causes and solutions.
| Error | Cause | Solution |
|---|---|---|
Cannot start dialogue: no StoryFlow project found. Import a project via StoryFlow > Import Project. | The StoryFlowManager could not discover a StoryFlowProjectAsset in your project. | Import a project via StoryFlow > Import Project. The manager auto-creates at runtime and auto-discovers the project asset. |
Cannot start dialogue: no script assigned and no startup script in project. | Called StartDialogue() without assigning a Script asset on the component, and the project has no startup script configured. | Assign a StoryFlowScriptAsset to the Script field in the Inspector, or use StartDialogue(scriptPath) to specify a script path at runtime. |
Cannot start dialogue: script not found at path "{path}". | The specified script path does not match any script in the imported project. | Verify the script path is correct. Check StoryFlowManager.Instance.GetAllScriptPaths() for available paths. Re-import the project if scripts were added recently. |
Cannot load save while dialogue is active. Stop all dialogues before loading. | LoadFromSlot() was called while one or more StoryFlowComponent instances have active dialogues. | Call StopDialogue() on all active components before loading. Check StoryFlowManager.Instance.IsDialogueActive() first. |
Processing depth exceeded {depth}. Possible infinite loop detected. Stopping dialogue. | Non-dialogue nodes form a cycle with no exit condition, causing the runtime to loop indefinitely. The default limit is 1000 iterations. | Check for loops in your node chains. Ensure every loop has a Branch node that eventually exits the cycle. |
Call stack overflow: too many nested script calls. | RunScript nodes have formed a recursive chain exceeding the maximum depth (20 levels). | Check for circular script references (Script A calls Script B, which calls Script A). Reorganize your script hierarchy. |
Flow stack overflow: too many nested flow calls. | RunFlow nodes have formed a recursive chain exceeding the maximum depth (50 levels). | Check for circular flow references. Flows should not call themselves or form loops. |
SetCharacterVar: character not found for path '{path}' | The character path used in a character variable node does not match any imported character. Paths are normalized to lowercase with forward slashes. | Ensure the character path matches the normalized format. Character paths are lowercased and use forward slashes internally. Re-import the project to ensure characters are present. |
Script not found: {scriptId} | A RunScript node references a script that does not exist in the project. The script may have been renamed or deleted. | Re-export and re-import the project to ensure all scripts are present. Check the script path in your node graph. |
Dialogue nodes cannot be used inside ForEach loops. | A dialogue node was placed inside a ForEach loop body, which is not supported. | Move the dialogue node outside the ForEach loop. Use variables to collect data inside the loop and display it in a dialogue after the loop completes. |
Import Issues
Missing Media Files
If images or audio files referenced in your project are not appearing after import:
- Check the build/media/ directory - The importer reads media files from the
build/media/folder inside the exported project. If files are missing there, re-export from the StoryFlow Editor with media included. - Verify file formats - Unity imports standard image formats (PNG, JPG) and audio formats (WAV, OGG). MP3 files are supported but WAV is recommended for best compatibility.
- Check the Console - The importer logs warnings for any files it cannot find or import. Look for
[StoryFlow]messages.
Newtonsoft.Json Errors
If you see errors related to Newtonsoft.Json or JsonConvert:
- Install the dependency - The StoryFlow package requires
com.unity.nuget.newtonsoft-json. This should be installed automatically by the Unity Package Manager when you add StoryFlow. If it was not, install it manually via Window > Package Manager > + > Add package by name and entercom.unity.nuget.newtonsoft-json. - Version conflicts - If your project already uses a different version of Newtonsoft.Json (e.g., from a third-party asset), you may see version mismatch errors. Ensure only one version is installed.
IL2CPP Stripping Issues
When building for platforms that use IL2CPP (iOS, WebGL, some Android builds), the code stripping process may remove types needed for JSON deserialization at runtime.
link.xml Protection
The StoryFlow package includes a link.xml file in the Runtime/ folder that prevents IL2CPP from stripping essential types. If you encounter TypeLoadException or JSON deserialization failures in IL2CPP builds, verify that the link.xml file is present in the package's Runtime/ directory. If you have moved the package files manually, ensure link.xml is included in your build.
Runtime Issues
Variables Not Updating
If variable values do not seem to change when you expect them to:
- Check the scope parameter - The
Get/SetXxxVariablemethods accept aglobalparameter. Whenglobalisfalse(default), the method searches local variables first, then global. If you need to target a specific global variable, passglobal: true. - Local variables reset per script - Local variables are scoped to the current script. When execution enters a new script via RunScript, local variables are re-initialized. Global variables persist across all scripts.
- Variable names are case-sensitive - The
nameparameter must match the variable's display name exactly as defined in the StoryFlow Editor.
// Reading a global variable
bool isQuestComplete = storyFlow.GetBoolVariable("QuestComplete", global: true);
// Reading a local variable (searches local first, then global)
int dialogueCounter = storyFlow.GetIntVariable("counter"); Dialogue Not Starting
If StartDialogue() is called but nothing happens:
- Check for errors - Subscribe to the
OnErrorevent to catch initialization errors. The most common cause is a missing project or invalid script path. - Verify the manager exists - Ensure a
StoryFlowManageris in the scene and has been initialized. If usingDontDestroyOnLoad, make sure the manager's scene is loaded first. - Check the script has a Start node - Every script must have a Start node with ID "0". If the script was corrupted or exported incorrectly, re-export from the editor.
- Verify the component is enabled - A disabled component or a disabled GameObject will not process dialogue. Check
gameObject.activeInHierarchyandenabled. - Check the Console -
[StoryFlow]prefixed warning and error messages are logged for all failure cases.
Audio Not Playing
If dialogue audio is not playing when expected:
- Check the audio file format - Unity supports WAV, OGG, and MP3. WAV is recommended for best compatibility. Ensure audio files were included in the project export.
- Check the AudioMixerGroup - If
DialogueAudioMixerGroupis assigned, ensure the mixer group is not muted and the volume is not set to zero. - Check the volume multiplier -
DialogueVolumeMultiplierdefaults to1.0but may have been set to0in the Inspector. - Audio requires fresh entry - Audio only plays when the dialogue node is entered for the first time, not when returning to it from a Set* node (which re-renders the dialogue text without replaying audio).
- Check StopAudioOnDialogueEnd - If this is
true(default), audio stops when the dialogue ends. If you expect audio to outlast the dialogue, set this tofalse.
UI Issues
Events Not Firing
If your UI is not receiving dialogue updates:
- Subscribe before starting - Ensure you subscribe to events (e.g.,
OnDialogueUpdated) before callingStartDialogue(). If you subscribe after the dialogue has already started, you will miss the initial state update. - Check the DialogueUI field - If you are using a
StoryFlowDialogueUIsubclass, assign it to the component'sDialogueUIfield in the Inspector. The binding happens automatically when dialogue starts, but only if the reference is set. - Manual binding - If you are not using the Inspector field, call
dialogueUI.InitializeWithComponent(storyFlowComponent)before starting the dialogue.
// Ensure events are subscribed before starting dialogue
void Start()
{
var storyFlow = GetComponent<StoryFlowComponent>();
// Subscribe to events FIRST
storyFlow.OnDialogueStarted += HandleDialogueStarted;
storyFlow.OnDialogueUpdated += HandleDialogueUpdated;
storyFlow.OnDialogueEnded += HandleDialogueEnded;
storyFlow.OnError += HandleError;
// THEN start dialogue
storyFlow.StartDialogue();
} Options Not Showing
If dialogue options are not appearing in your UI:
- Check IsOnceOnly - Once-only options disappear after being selected. If all options in a dialogue node are once-only and have been used, the options list will be empty. Check
state.Options.Countandoption.IsSelected. - Check conditional visibility - Options may be hidden by branch conditions in the StoryFlow Editor. If an option's visibility condition evaluates to
false, it will not appear in theOptionslist. - Check CanAdvance - If the dialogue state has
CanAdvance == trueandOptions.Count == 0, the dialogue is in "continue" mode (narrative text with no choices). Show a continue button instead of options.
Debugging
Enable Verbose Logging
The plugin includes two logging options in StoryFlowSettings that can help diagnose issues:
- VerboseLogging - Logs every node that is processed during execution. This shows the exact order of node traversal, making it easy to trace the execution path and identify where things go wrong.
- LogVariableChanges - Logs every variable change during execution, including the variable name, new value, and whether it is local or global. Useful for debugging Branch nodes that always take the wrong path.
To enable these options, create a StoryFlowSettings asset via Assets > Create > StoryFlow > Settings, place it in a Resources/ folder, name it StoryFlowSettings, and check the desired logging toggles.
Subscribe to OnError
Always subscribe to the OnError event during development. This catches runtime errors that might otherwise go unnoticed if you are not watching the Console.
var storyFlow = GetComponent<StoryFlowComponent>();
storyFlow.OnError += (message) =>
{
Debug.LogError($"[StoryFlow Error] {message}");
// Optionally show in-game error UI during development
#if UNITY_EDITOR || DEVELOPMENT_BUILD
ShowDebugOverlay(message);
#endif
}; Track Variable Changes
Subscribe to OnVariableChanged to monitor variable state during execution. This is especially useful when debugging Branch nodes that always take the same path:
storyFlow.OnVariableChanged += (variable, isGlobal) =>
{
string scope = isGlobal ? "global" : "local";
Debug.Log($"[StoryFlow] Variable changed [{scope}]: " +
$""{variable.Name}" = {variable.Value} (type: {variable.Type})");
}; Check Unity Console
All StoryFlow plugin messages use the [StoryFlow] prefix. In the Unity Console window, use the search box to filter for "StoryFlow" to see only plugin-related messages. This includes:
- Initialization messages when the manager loads a project
- Import progress and results
- Node execution logs (when verbose logging is enabled)
- Variable change logs (when variable logging is enabled)
- Warnings for missing assets, null references, or invalid state
- Error messages for execution failures
Cross-Reference with the Editor
Many plugin errors mirror editor runtime errors. If you see an error in Unity, try playing the same script in the StoryFlow Editor's Play Window to reproduce it. The editor's Runtime Debugger provides a visual, step-by-step view of execution that can pinpoint the exact node causing the problem.
Use Live Sync for Rapid Iteration
When debugging, use Live Sync to push changes from the StoryFlow Editor to Unity without manually re-exporting. Fix a broken connection or update variable logic in the editor, save, and immediately test the fix in Unity.
Editor Errors Page
For a complete list of editor-side error messages and their solutions, see the Errors & Troubleshooting page in the editor documentation. Many errors are shared between the editor runtime and the Unity plugin.