Setting Watch Tab Bool Messes With Game Time

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Unrighteous
Posts: 36
Joined: Thu Mar 17, 2022 5:32 pm

Setting Watch Tab Bool Messes With Game Time

Post by Unrighteous »

Hey,

This isn't a big deal, but I thought I'd make a post about it since I couldn't find any information on this when I was trying to figure out the issue.

For context, I was debugging a screen fade controlled by a dialogue bool variable. To test this, I would change the bool variable through the "Watches" tab. The fade kept happening instantly, and I couldn't figure out why. Eventually, I decided to set the bool variable through code using "DialogueLua.SetVariable" and for some reason the fade worked correctly when doing this.

After a bunch of testing, I realized that clicking on the bool field to change its value in the watches tab was pausing my game, and after setting the bool value, the game would resume at a different time. Essentially, my fade was being skipped. This was a real head scratcher as my working code appeared like it wasn't working, and it took me a while to work out what was going on.

This is a pretty niche case, and I don't even think I would consider this a bug, but I thought I'd post this in case anyone else ever ran into the same issue (and when I run into this issue two years from now and forget what was going on haha).

Just in case this behavior is different in newer versions, I'm using version 2.2.33 and Unity 2020.3.43f1.
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting Watch Tab Bool Messes With Game Time

Post by Tony Li »

Hi,

If the fade runs in Unscaled Time -- or with Dialogue Time set to Realtime, which is the same thing -- it will fade according to the system clock, which keeps running even if the Unity editor pauses to wait for input such as a selection from a dropdown menu in the Watches tab. When the Unity editor resumes, the system clock will have run ahead, so the fade will jump to the state it should be in according to system time.
Unrighteous
Posts: 36
Joined: Thu Mar 17, 2022 5:32 pm

Re: Setting Watch Tab Bool Messes With Game Time

Post by Unrighteous »

Thanks for the explanation!

If I had caught the game pausing sooner, I may have figured it out a bit quicker. I was looking at the watches tab while setting the variable, so I wasn't looking at the game during those few seconds haha.

Glad to have the technical explanation, makes a lot more sense now.
User avatar
Tony Li
Posts: 22134
Joined: Thu Jul 18, 2013 1:27 pm

Re: Setting Watch Tab Bool Messes With Game Time

Post by Tony Li »

Happy to help!
Post Reply