Hi, I’m new to Dialogue system and I am currently learning thru the tutorials. I came across the section for running Unity Scene Events and I can’t seem to get it to work properly. I’m wondering if I missed a necessary step?
I copied the dialogue Manager and create my own demo-dialogue database. In one of the nodes, it attempts to call a unity event.
My conversation node calls to a scene object that calls a Print(); It doesn’t seem to fire. I wanted to call a separate UI where the player would be able to do other tasks like a character sheet/menu.
Learning Dialogue System - Need help with Scene Events
Learning Dialogue System - Need help with Scene Events
- Attachments
-
- Screen Shot 2021-06-04 at 11.48.09 AM.png (198.55 KiB) Viewed 421 times
Re: Learning Dialogue System - Need help with Scene Events
Adding an update, I find that when I run it, the links are removed as shown by the attached image.
- Attachments
-
- Screen Shot 2021-06-04 at 12.27.13 PM.png (32.22 KiB) Viewed 419 times
Re: Learning Dialogue System - Need help with Scene Events
Hi,
It looks like the connection from the dialogue entry node to its scene event is still good, but the scene event itself has a configuration issue -- mostly like caused by assigning a GameObject that survives scene changes or otherwise becomes unavailable at some point during play. Only assign GameObjects that aren't marked Don't Destroy On Load. You can also assign asset files such as prefabs and ScriptableObject assets.
For example, say you have scenes 1 and 2.
It looks like the connection from the dialogue entry node to its scene event is still good, but the scene event itself has a configuration issue -- mostly like caused by assigning a GameObject that survives scene changes or otherwise becomes unavailable at some point during play. Only assign GameObjects that aren't marked Don't Destroy On Load. You can also assign asset files such as prefabs and ScriptableObject assets.
For example, say you have scenes 1 and 2.
- In scene 1, you have a Dialogue Manager that we'll call Dialogue Manager 1A.
- In scene 2, you have a Dialogue Manager named Dialogue Manager 2A.
- When you change from scene 1 to 2 during play, Dialogue Manager 1A will survive the scene change and replace Dialogue Manager 2A. If any scene events in scene 2 pointed to Dialogue Manager 2A, they'll be "Missing" now.
- Then say you change back to scene 1. This newly-loaded version of scene 1 contains a GameObject we'll call Dialogue Manager 1B. Any scene events in this version of the scene will point to Dialogue Manager 1B. However, Dialogue Manager 1A will survive the scene change and replace Dialogue Manager 1B, once again causing the "Missing" issue.
If that info doesn't help, here's some background info on how scene events work:
Do you have multiple scenes open at the same time in the editor?
When you add a scene event to a dialogue entry node, it will create a GameObject named "Dialogue System Scene Events" in the currently-open scene if it doesn't exist. Then it will add a unique GUID string such as "cffdde7e-6bee-4f65-b1e4-25af9b111a2f" to the GameObject's Dialogue Entry Scene Events list.
The dialogue entry node's Scene Event will record the GUID string. When the node is displayed at runtime, it will check the currently-open scene for a "Dialogue System Scene Events" GameObject. If it finds one, it will look up its GUID string in the GameObject's list. If it finds its GUID string, it will execute the event (and show it in the dialogue entry node inspector if you have the Dialogue Editor window open on the node during play).
Scene events are just plain old Unity events. As such, they can point to a specific GameObject. If this GameObject disappears from the context of the scene, you'll get that "Missing" error.
When you add a scene event to a dialogue entry node, it will create a GameObject named "Dialogue System Scene Events" in the currently-open scene if it doesn't exist. Then it will add a unique GUID string such as "cffdde7e-6bee-4f65-b1e4-25af9b111a2f" to the GameObject's Dialogue Entry Scene Events list.
The dialogue entry node's Scene Event will record the GUID string. When the node is displayed at runtime, it will check the currently-open scene for a "Dialogue System Scene Events" GameObject. If it finds one, it will look up its GUID string in the GameObject's list. If it finds its GUID string, it will execute the event (and show it in the dialogue entry node inspector if you have the Dialogue Editor window open on the node during play).
Scene events are just plain old Unity events. As such, they can point to a specific GameObject. If this GameObject disappears from the context of the scene, you'll get that "Missing" error.
Re: Learning Dialogue System - Need help with Scene Events
Thank you for the answer Tony! I’ve resolved the issue. Though in my case it may have been an issue with unity. The scene I used was duplicated from another scene. This may have caused something in unity not to refresh.
I simply recreated the scene from scratch and everything worked perfectly!
I simply recreated the scene from scratch and everything worked perfectly!
Re: Learning Dialogue System - Need help with Scene Events
Hi,
You nailed the reason. When you duplicated the scene, it duplicated the Dialogue System Scene Events. But the UnityEvent in the Dialogue System Scene Events has an internal reference to a GameObject in the original scene, so it's showing up as missing here.
You nailed the reason. When you duplicated the scene, it duplicated the Dialogue System Scene Events. But the UnityEvent in the Dialogue System Scene Events has an internal reference to a GameObject in the original scene, so it's showing up as missing here.