RAW Datat value is null

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
OneManOnMars
Posts: 105
Joined: Tue Apr 05, 2016 9:37 am

RAW Datat value is null

Post by OneManOnMars »

Hey,
I have a cloudy problem I would like to post here. I am working on a game for Nintendo Switch and currently, I have a problem while saving. "Something" seems to crash during this process. It is quite hard to pin down just because it only happens in the release build not in the dev build.
This leads to the game not writing anymore to the disk. As long as you don't turn of the app saving works fine, but if you want to load the savegame file you will see, that it has not been saving for quite a while(depending on when this issue happened).

This bug happens either when saving before exiting the scene. Or when loading the data loading the new scene or somewhere in between.

While hunting this down we found out that in the PersistentDataManager of the Dialogue System, the values for Location, Actor, Variable, and Item can return a null value. This seems to lead to that issue.

Line 1388:

Code: Select all

public static byte[] GetRawData()
        {
            Record();
            using (var ms = new MemoryStream())
            {
                var writer = new BinaryWriter(ms);
                var conversationTable = Lua.Run("return Conversation").AsTable.luaTable;
                PrepSimStatusForRawData(conversationTable);
                WriteValue(writer, Lua.Run("return Actor").AsTable.luaTable);
                WriteValue(writer, Lua.Run("return Item").AsTable.luaTable);
                WriteValue(writer, Lua.Run("return Location").AsTable.luaTable);
                WriteValue(writer, Lua.Run("return Variable").AsTable.luaTable);
                WriteValue(writer, conversationTable);
                WriteExtraData(writer);
                writer.Flush();
                return ms.GetBuffer();
            }
        }
I know this is not much to go with but it might show how desperate I am looking for a solution! Maybe you have a clue what is going on or in what direction I could look into.
OneManOnMars
Posts: 105
Joined: Tue Apr 05, 2016 9:37 am

Re: RAW Datat value is null

Post by OneManOnMars »

I guess this is how game development goes sometimes. After working on the reported issue for days without any idea how to solve it I found the problem just shortly after I posted the initial post.

The solution might be of interest to you. I have removed all SequenceTrigger and replaced them with DialogueSystemTrigger. I still had a few in that scene. This replacement was just just a shot in the dark but since then the bug never happened again.

Does this make sens in any way?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: RAW Datat value is null

Post by Tony Li »

Hi,

The values for Location, Actor, Variable, and Item should never return null as long as there's a Dialogue Manager in the scene.

I don't see anything in SequenceTrigger that would cause the issue you described. What were their Trigger dropdowns set to?
OneManOnMars
Posts: 105
Joined: Tue Apr 05, 2016 9:37 am

Re: RAW Datat value is null

Post by OneManOnMars »

Well yes, I still feel this is kinda wired. So maybe the true problem is somewhere else but for now, it seems as if this did prevent the bug from repeating.

Another idea is that maybe these values are null in a certain part of the frame while either loading or saving the data.

Image

Here are a few examples of what I am doing with these triggers.

Mostly I am triggering sequences or dialogues depending on quests or variable conditions.
Or here and there I am activating or deactivating gameobjects.
Last edited by OneManOnMars on Wed Feb 22, 2023 10:58 am, edited 1 time in total.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: RAW Datat value is null

Post by Tony Li »

Sequence Trigger is deprecated, so it's probably for the best to use Dialogue System Triggers instead.

You could also try setting your Dialogue System Triggers' OnStart triggers to OnSaveDataApplied instead. When loading a saved game, the trigger won't start until the saved game data has been applied. If not loading a saved game, it waits for the equivalent number of frames (as determined by the Save System component's Frames To Wait Before Apply Data value).
OneManOnMars
Posts: 105
Joined: Tue Apr 05, 2016 9:37 am

Re: RAW Datat value is null

Post by OneManOnMars »

Thank you Tony,

this sounds like a good approach!
Post Reply