Recording Variable of Answers as CSV

Announcements, support questions, and discussion for the Dialogue System.
jibjab910
Posts: 18
Joined: Fri Mar 02, 2018 7:46 pm

Re: Recording Variable of Answers as CSV

Post by jibjab910 »

Dear Tony,
Thank you so much! I will try that out right now and let you know how it works.
jibjab910
Posts: 18
Joined: Fri Mar 02, 2018 7:46 pm

Re: Recording Variable of Answers as CSV

Post by jibjab910 »

Dear Tony,
I implemented it, and it did not work, unfortunately. I fixed the typo and put the SaveAndLoadAcrossScenes into a script and referenced that script in a game object in all the scenes. I am not sure why it doesn't work. I could send you the game, but I have no idea how to do that.
jibjab910
Posts: 18
Joined: Fri Mar 02, 2018 7:46 pm

Re: Recording Variable of Answers as CSV

Post by jibjab910 »

Dear Tony,
It might be simpler to offload each variable to a global variable (i.e. append the new values to the past ones at the end of every scene), as I am only using two variables, DMEAnswers and EarthquakeAnswers. Unfortunately, I don't have any idea how to do this.
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Recording Variable of Answers as CSV

Post by Tony Li »

Hi,

Here's an example scene:

SaveAndLoadAcrossScenesExample_2018-04-09.unitypackage

You might want to import it into a new, empty, non-VR project. It replaces a couple of old scenes in Assets / Dialogue System / Examples / Save Load Example. The old scenes use legacy Unity GUI, which isn't visible in VR. It also includes a version of the SaveAndLoadAcrossScenes script that logs its activity to the Console. The script is on each scene's Dialogue Manager. To play the example, add the scenes "Airlock" and "Server Room" in that folder. Then open the "Airlock" scene and play it. Turn around and press the space bar to change scenes to the "Server Room" scene. You should see two lines.

The first line indicates that the old scene has saved its data:

Code: Select all

Record save data: Variable={Alert="", Actor="Player", Conversant="Sergeant Graves", ActorIndex="Player",...
The second line indicates that the new scene has restored this data:

Code: Select all

Applying previously-saved data: Variable={Alert="", Actor="Player", Conversant="Sergeant Graves",...
---

Alternatively, here's another way to avoid the whole issue:

1. Tick the Dialogue Manager's Dont Destroy On Load and Allow Only One Instance checkboxes.

2. In each scene, add the script below to the scene's main dialogue UI:

SetAsMainDialogueUI.cs

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;

public class SetAsMainDialogueUI : MonoBehaviour
{

    void Start()
    {
        var dialogueUI = GetComponentInChildren<AbstractDialogueUI>();
        if (dialogueUI != null)
        {
            Debug.Log("Using " + dialogueUI.name + " as the main dialogue UI.", dialogueUI);
            DialogueManager.UseDialogueUI(dialogueUI.gameObject);
        }
    }
}
Post Reply