Hi there again!
So I have a scene with a Dialogue Manager in it as part of a prefab, I load to a different scene without one, I do some database saving stuff, then I load back to the original scene.
The behaviour I have is that a new one is created at Runtime and because only one is permitted my original, prefabbed one gets nuked.
What would cause this behaviour? Is there something being called too early that's creating one on the fly?
Thanks,
BB
What situation/call would create a new Dialogue Manager dynamically
-
- Posts: 91
- Joined: Tue Jul 14, 2015 8:22 am
Re: What situation/call would create a new Dialogue Manager dynamically
Almost all Dialogue System operations require the presence of a Dialogue Manager GameObject.
Version 1.x creates a new, default Dialogue Manager if one doesn't exist when a Dialogue System operation runs.
That was changed in version 2.x, where it just reports a "missing Dialogue Manager" error instead.
Can you put the Dialogue Manager GameObject in that first scene?
Version 1.x creates a new, default Dialogue Manager if one doesn't exist when a Dialogue System operation runs.
That was changed in version 2.x, where it just reports a "missing Dialogue Manager" error instead.
Can you put the Dialogue Manager GameObject in that first scene?
-
- Posts: 91
- Joined: Tue Jul 14, 2015 8:22 am
Re: What situation/call would create a new Dialogue Manager dynamically
There already is a DialogueManager in the first scene.
So is something being called before the dialoguemanager has initialised maybe?
Would I then see this?
So is something being called before the dialoguemanager has initialised maybe?
Would I then see this?
Re: What situation/call would create a new Dialogue Manager dynamically
Yes, that might happen if something tried to use a Dialogue System operation in an Awake() method that runs before the Dialogue Manager's DialogueSystemController.Awake. As a test, name your Dialogue Manager something unique, such as "Dialogue Manager Good". Then play that first scene. After the scene starts, check if "Dialogue Manager Good" is present in the scene or if a default one has been created. If a default one has been created, here are two options:
1. Call your operation in Start() instead of Awake().
2. Or go to Edit > Project Settings > Script Execution Order, and set the DialogueSystemController's order to be a negative number (i.e., not zero or higher) so its Awake runs first.
1. Call your operation in Start() instead of Awake().
2. Or go to Edit > Project Settings > Script Execution Order, and set the DialogueSystemController's order to be a negative number (i.e., not zero or higher) so its Awake runs first.
-
- Posts: 91
- Joined: Tue Jul 14, 2015 8:22 am
Re: What situation/call would create a new Dialogue Manager dynamically
We're back again!
So here's what happens.
Load new scene, it does not contain a dialogueManager, loads my data, at the end when I save my data before loading a new scene a new DialogueManager is created dynamically by your code.
I then in my code find this new DialogueManager and delete it before loading back to my intended scene. All is well.
However in the same session if I now return to that scene, a new one is now longer created, the save asserts stopping the game from loading to the other scene I'm loading to.
At this point I'm thinking of dynamically creating a new one myself at the right time to solve this, but I'm going through major backfips to solve this problem,.
Any ideas?
So here's what happens.
Load new scene, it does not contain a dialogueManager, loads my data, at the end when I save my data before loading a new scene a new DialogueManager is created dynamically by your code.
I then in my code find this new DialogueManager and delete it before loading back to my intended scene. All is well.
However in the same session if I now return to that scene, a new one is now longer created, the save asserts stopping the game from loading to the other scene I'm loading to.
At this point I'm thinking of dynamically creating a new one myself at the right time to solve this, but I'm going through major backfips to solve this problem,.
Any ideas?
Re: What situation/call would create a new Dialogue Manager dynamically
Can you make sure a valid Dialogue Manager exists before calling your save data? For example, put your good Dialogue Manager in the start scene.
I think the problem is that the auto-created Dialogue Manager assigns itself to the static property DialogueManager.Instance. But when you destroy the Dialogue Manager underneath it, the Instance variable is left hanging with an invalid value.
I think the problem is that the auto-created Dialogue Manager assigns itself to the static property DialogueManager.Instance. But when you destroy the Dialogue Manager underneath it, the Instance variable is left hanging with an invalid value.