Root directory of dialogue database

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hipsterdufus
Posts: 97
Joined: Thu Aug 12, 2021 6:39 pm

Root directory of dialogue database

Post by hipsterdufus »

Hi, I recently had a problem with my unity project and ended up renaming the root directory. Eventually I renamed it back to what it was originally but I'm seeing in the dialogue system info logs that the root directory for the dialogue system is still pointing to the previous root directory even though the project is currently in the right place. Where can I fix this? Thank you
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Root directory of dialogue database

Post by Tony Li »

Hi,

What do you mean?

Can you post screenshots?
hipsterdufus
Posts: 97
Joined: Thu Aug 12, 2021 6:39 pm

Re: Root directory of dialogue database

Post by hipsterdufus »

Sorry, I think that issue was just a Unity issue - it was storing the package in a cache folder and displaying the wrong path in the console for the files. I deleted the cache and it seems to be normal now.

However, I'm still trying to debug my issue. I'm trying to save and load the dialogue db. I already have a save system so I just need to tie the string representation of the dialogue db into that system. First issue is the Variables section of the Dialogue System UI does not seem to update during gameplay. Is that expected behavior? Second issue is I don't seem to be able to reset Variables in code. For example, when a save is loaded, I am resetting certain dialogue db variables like this:

DialogueLua.SetVariable("DailyChatFinished_dak", false);

Basically making it possible to talk to a character for that day. However, it doesn't seem to be doing anything because I still can't talk to the character. I believe it's just not updating the variable value but it's hard to tell since the Dialogue Variable section doesn't seem to update during gameplay. In the console however, it looks like the variables are correct when the save happens. I'll try to debug more but is there a good way to get visibility on the state of the variables? It seems like the UI isn't updating and the console output is the only thing to trust?

I'm saving the data like this:
dialogueDatabase = PersistentDataManager.GetSaveData(), // this is a paremeter of a larger json object that gets saved

and loading like this:
PersistentDataManager.ApplySaveData(saveData.dialogueDatabase); // Restore state from that parameter

My saving and loading works so I have confidence in that portion of it.
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Root directory of dialogue database

Post by Tony Li »

Hi,
hipsterdufus wrote: Wed Aug 18, 2021 11:42 amI'm trying to save and load the dialogue db. I already have a save system so I just need to tie the string representation of the dialogue db into that system.
Just use PersistentDataManager.GetSaveData() and ApplySaveData() like you're doing lower down in your post.
hipsterdufus wrote: Wed Aug 18, 2021 11:42 amFirst issue is the Variables section of the Dialogue System UI does not seem to update during gameplay. Is that expected behavior?
Yes. You may notice that the column is titled "Initial Value". This is the initial value, not the current runtime value. To see the current runtime values of variables, quests, etc., use the Watches tab. Or, for variables, use the Variable View window.
hipsterdufus wrote: Wed Aug 18, 2021 11:42 am Second issue is I don't seem to be able to reset Variables in code. For example, when a save is loaded, I am resetting certain dialogue db variables like this:

DialogueLua.SetVariable("DailyChatFinished_dak", false);
The Watches tab or Variable View should help you get to the bottom of your issue here.
hipsterdufus
Posts: 97
Joined: Thu Aug 12, 2021 6:39 pm

Re: Root directory of dialogue database

Post by hipsterdufus »

Thanks, still debugging but I think I can get to the bottom of it now. There's no "Initial Value" label that I can see in my Unity version 2020.3.16f1.
User avatar
Tony Li
Posts: 22159
Joined: Thu Jul 18, 2013 1:27 pm

Re: Root directory of dialogue database

Post by Tony Li »

That's right; I forgot that when the Variables section was changed to a reorderable list we omitted the header for compactness.
Post Reply