YarnSpinnerTool / YarnSpinner-Unity

The official Unity integration for Yarn Spinner, the friendly dialogue tool.
MIT License
491 stars 85 forks source link

SetProject() doesn't work after v2.3.1 update #245

Closed opennoise1 closed 1 year ago

opennoise1 commented 1 year ago

What is the current behavior? I have a script that, on Start(), sets my dialogue runner's Yarn Project. It chooses a Yarn Project from a list of them, and then calls SetProject(). This script always worked, but it suddenly stopped setting the project after I updated to Yarn Spinner v2.3.1. Even though SetProject() is called, dialogue.YarnProject remains null.

Please provide the steps to reproduce, and if possible a minimal demo of the problem:

  1. Create a new scene.
  2. Add the Dialogue System prefab that comes with Yarn Spinner into the hierarchy.
  3. Create a scene manager object in the hierarchy.
  4. Write a script that creates a list of projects and calls SetProject() on Start(). Something like this:
    
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Yarn.Unity;

public class TestForYarn : MonoBehaviour { public DialogueRunner dialogue; public List yarnProjects;

// Start is called before the first frame update
void Start()
{
    dialogue.SetProject(yarnProjects[0]);
}

}


5. Attach that script to the scene manager object.
6. Add a Yarn Project into the `yarnProjects` list on the script in the inspector.
7. Make sure to reference the Dialogue System's dialogue runner on this script in the inspector too.
8. Press play.

**What is the expected behavior?**
I expect the correct Yarn Project to be assigned to the dialogue runner.

**Please tell us about your environment:**

  - Yarn Spinner Version: 2.3.1
  - Unity Version: 2021.3.27f1

**I've attached a few screenshots of how everything should be set up:**
<img width="391" alt="yarnissue1" src="https://github.com/YarnSpinnerTool/YarnSpinner-Unity/assets/38442069/d0450580-8c5f-4331-8474-9777fad5d8cc">

<img width="238" alt="yarnissue2" src="https://github.com/YarnSpinnerTool/YarnSpinner-Unity/assets/38442069/4a5dfc11-1408-4b23-85cc-f77f87adb46f">

<img width="309" alt="yarnissue3" src="https://github.com/YarnSpinnerTool/YarnSpinner-Unity/assets/38442069/a696249b-6ecf-43a3-a531-3b4111670c94">

<img width="309" alt="yarnissue4" src="https://github.com/YarnSpinnerTool/YarnSpinner-Unity/assets/38442069/666d14c3-127b-41ed-85bd-e9968307671a">

Thank you!
McJones commented 1 year ago

this should have been closed when #246 was merged, my bad.