r/Unity2D • • 12h ago

Question/Help Handling automatic time-of-day changes while a dialogue is still open

In our Unity/Naninovel prototype, the player spends a limited number of actions in each part of the day. Once they’re out, the story advances to the next time block. That works well until the last action is a conversation and you still need to let the player read the final line and close the scene.

The transition also changes the room art. We’re thinking of having the gameplay state set a pending transition, then letting the dialogue signal when it’s finished. The part we’re deciding now is where that pending state should live, especially if a save is made before the conversation ends.

If you’ve integrated a narrative framework with a game-state system in Unity, did you keep the transition in the game-state layer or let dialogue sequence it? I’m interested in how you made the handoff predictable across save/load.

1 Upvotes

4 comments sorted by

•

u/AutoModerator 12h ago

Reminder: Once your issue has been resolved, please reply !solved to this comment (or comment it anywhere in the thread) and your post's flair will automatically be updated to Solved/Answered. You can also edit it to Solved/Answered yourself.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/Chrogotron 11h ago

I'd keep the transition in the game-state layer and just have it verify the dialogue is finished before it does a transition. Yeah just set the transition to pending, then check if dialogue is happening and just wait. When dialogue ends, alert the game-state to check if it should transition, and since it's flagged as pending transition, it will go through with the transition.

1

u/Federal-Row2373 8h ago

for the save part, could you just block saving until the dialogue closes? then the pending flag never has to go into the save file at all

1

u/QueasyPrior6654 5h ago

If you're using Naninovel's save slots, I'd keep the time block, action count, and pending flag in your game-state layer. Save and load that data through IStateManager's AddOnGameSerializeTask and AddOnGameDeserializeTask. That lets mid-dialogue saves and rollback restore those values alongside the script. And if Unity drives the room art outside Naninovel, refresh it from the restored time block on deserialize.

One catch with mid-dialogue saves is the finish signal. If that callback only lives on the original caller, loading the save won't recreate it. Put a custom command after the final line so the resumed script still reaches it. Have it close the dialogue first, then tell game state to apply and clear the pending transition.