YarnSpinnerTool / YarnSpinner

Yarn Spinner is a tool for building interactive dialogue in games!
https://yarnspinner.dev
MIT License
2.3k stars 201 forks source link

WebGL: No nodes have been loaded. #358

Closed ryared closed 1 year ago

ryared commented 1 year ago

What is the current behavior?

When building to WebGL, the dialogue nodes are not loaded. DialogueException: Cannot load node Sally: No nodes have been loaded.

Please provide the steps to reproduce, and if possible a minimal demo of the problem: In essence, create a fresh unity project, install Yarn Spinner and the space sample, build it to WebGL and run.

  1. Create a new Unity 2021.3.16f1 Project using the 3D Core template.
  2. Install Yarn Spinner through OpenUPM https://docs.yarnspinner.dev/using-yarnspinner-with-unity/installation-and-setup#setting-up-the-openupm-registry-in-your-project
  3. Install and Import the Space Sample
  4. Open the Space scene and import TMP essentials. 4.5 (optional) Open space scene and test.
  5. File > Build Settings > Switch Platform
  6. Open Space scene, then add open scene in build settings.
  7. Go to player settings and change color space to Gamma (Other Settings > Rendering _ Color Space)
  8. Still in player settings change Publishing Settings > Compression format to Disabled (Else will get an error when trying to run the game)
  9. Start the WebGL build through python by opening cmd or PowerShell and navigating to the build location and running: python -m http.server
  10. Go to a browser and open localhost:8000 (or whichever port you chose)
  11. Move the character and try to start the dialogue.
  12. Open console to see the error.

What is the expected behavior?

The sample scene dialogue should run without throwing an error.

Please tell us about your environment:

Other information This problem also appears in a non-sample project which is how this problem was discovered.

Two errors pop up in the console: The first one happens when the game starts up OutDisabled.framework.js:3 ExecutionEngineException: Attempting to call method 'System.Func`1[[System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]::.ctor' for which no ahead of time (AOT) code was generated.

_JS_Log_Dump @ OutDisabled.framework.js:3

And the second one happens when a dialogue is trying to be run: DialogueException: Cannot load node Sally: No nodes have been loaded. at Yarn.VirtualMachine.SetNode (System.String nodeName) [0x00000] in <00000000000000000000000000000000>:0

Thank you for your time!

ryared commented 1 year ago

Ah posted on the wrong repo, sorry!

The current "fix" is Build Settings > WebGl IL2CPP Code Generation: Set it to "Faster (smaller) buids" instead of "Faster runtime"

https://github.com/YarnSpinnerTool/YarnSpinner-Unity/issues/163 (Initially, found the solution through discord.) https://discord.com/channels/754171172693868585/1074177617474883676