Page 1 of 1

UI Panel's OnOpen or OnClose Action doesn't work after saved game loaded

Posted: Tue Apr 09, 2019 4:42 pm
by LeeDongkun
Hi!
I gladly use your QuestMachine asset and SaveSystem asset. It's awesome.

but, I Have some problem

I added some custom action to UI Panel's OnOpen and OnClose action. because I need to Character unmoved and mouselocked.

But after I loaded saved game, these custom action doesn't work.
I have no idea why this happen.


and, why completed quest journal is cleared after I loaded my saved game?

Your save system saves quest automatically, but journal is cleared after load game.
This also I can't find out how to correct it.

Re: UI Panel's OnOpen or OnClose Action doesn't work after saved game loaded

Posted: Tue Apr 09, 2019 5:05 pm
by Tony Li
Hi,
LeeDongkun wrote: Tue Apr 09, 2019 4:42 pmI gladly use your QuestMachine asset and SaveSystem asset. It's awesome.
Thanks!
LeeDongkun wrote: Tue Apr 09, 2019 4:42 pmI added some custom action to UI Panel's OnOpen and OnClose action. because I need to Character unmoved and mouselocked.

But after I loaded saved game, these custom action doesn't work.
The Quest Machine GameObject survives scene changes. You added custom actions that point to your character. When you load a game, Unity unloads the original scene, including your character. The custom actions now don't point to anything. After unloading the original scene, Unity loads a new copy of the scene. But the custom actions still don't point to the character in the new copy of the scene because they were configured to point to the character in the original scene.

Here are three different solutions:

1. You can remove the Quest Machine GameObject's Dont Destroy GameObject component. This will load a new Quest Machine GameObject with the new copy of the scene. It's not as efficient because the new Quest Machine GameObject will need to initialize itself again, but it's an easy solution. If you use this solution, make sure the Save System is on a different GameObject, like in the Demo scene.

2. Or you can add a script to the Quest Machine GameObject that finds the player and locks/unlocks it. Configure your custom action to call this script.

3. Or, Quest Machine sends the message "Pause Player" when it opens the dialogue UI or journal UI. It sends the message "Unpause Player" when it closes the UI. You can update your character script when it receives these messages. See the demo's PlayerController2D.cs script for an example.

LeeDongkun wrote: Tue Apr 09, 2019 4:42 pmand, why completed quest journal is cleared after I loaded my saved game?
Check the Quest Journal's Save Settings. Try these settings:

Image

Re: UI Panel's OnOpen or OnClose Action doesn't work after saved game loaded

Posted: Tue Apr 09, 2019 8:59 pm
by LeeDongkun
Very Very Thank you
It works great!

:D

Re: UI Panel's OnOpen or OnClose Action doesn't work after saved game loaded

Posted: Tue Apr 09, 2019 9:37 pm
by Tony Li
Happy to help! :-)