I have implemented serialization/de-serialization process in my Unity game where I save/load data from/to XML file.
During the serialization, my game isn't responding until the serialization is finished and this is OK.
What is wrong is that before I call the serialization/de-serialization, I want to show saving/loading panel and show log process, but can't: this panel and all the log information show up only after the serialization/de-serialization is finished.
What I have verified and tried:
- The panels hierarchy is correct
- During serialization/de-serialization, no error occur
- Panels are assigned manually to specified variables
- If I comment out the save/load calls and leave only the panel, then the panel is shown
- I have also tried to put the thread to
sleep
but still, nothing happens.
Can anybody can help me? Because I really don't know why this is happening like this.
Here is an snippet of my code:
public void SaveGameClick() {
SavingPanel.gameObject.SetActive(true); // if I leave only this line and the other line
// commenting the panel shows perfectly
Debug.Log("Saving..."); // this Saving word shown only when the _savegame.Save() method
// finished
if(_saveGame.Save("save.xml", Seed)) {
Debug.Log("Saved");
CyberTeamManagerSubMenu.gameObject.SetActive(false);
_isShowCyberTeamManagerSubMenu = false;
SavingPanel.gameObject.SetActive(false);
} else {
Debug.Log("Save Error");
SavingPanel.gameObject.SetActive(false);
}
}