My save system suddenly disappears when I press "play" and I can't figure out why.
I had it working, then changed the prefab structure of my global singleton - but in a place that should not affect the save system - and now suddenly whenever I press "play", it just vanishes. No debug message, nothing.
I've tried unparenting it from the Dialogue Manager (which for some reason suddenly reparents itself) and that does nothing. If I disable the Save System game object, it spawns me a new one from the prefab, as soon as I enable the existing one it vanishes. It does NOT spawn me a new one if I leave the old one enabled, then it just vanishes. And spawning one is no good for me as I need a reference to trigger saving and loading.
I made sure that I don't happen to have a second game object named "Save System" in the scene.
I know this isn't a good bug report, but I have not the slightest clue what is causing this, none of the changes I made (adding a new UI menu, adding two variables to one saver, unpacking one prefab unrelated to the save system, etc.) would make sense as a cause of this, but there it is.
Just a clue where to start searching for what's going on would be great.
Save System Disappears
-
- Posts: 150
- Joined: Mon Nov 23, 2020 6:35 am
Re: Save System Disappears
hm... it detects ITSELF and then commits suicide:
That's something it didn't do before, even though code wasn't changed. Maybe something in the script execution order in Unity shifted or whatever - but is it intended behaviour that the Save System terminates like that? That means there is no way to have a Save System object in the scene or a global singleton like I do.
Code: Select all
private void Awake()
{
if (m_instance == null)
{
m_instance = this;
if (transform.parent != null) transform.SetParent(null);
DontDestroyOnLoad(gameObject);
}
else
{
Debug.Log(m_instance.gameObject.name);
if (m_instance == this) {
Debug.Log("myself!");
}
Destroy(gameObject);
}
}
Re: Save System Disappears
Hi,
Have you disabled domain reloading? If so, please try backing up your project and updating to the latest version of the Dialogue System. When Unity added the ability to disable domain reloading, the SaveSystem script had to be updated.
Are you calling any SaveSystem methods before the SaveSystem component has a chance to run its Awake() method?
Have you disabled domain reloading? If so, please try backing up your project and updating to the latest version of the Dialogue System. When Unity added the ability to disable domain reloading, the SaveSystem script had to be updated.
Are you calling any SaveSystem methods before the SaveSystem component has a chance to run its Awake() method?
-
- Posts: 150
- Joined: Mon Nov 23, 2020 6:35 am
Re: Save System Disappears
Never heard about domain reloading before, interesting. But I updated neither Unity nor Dialogue System between it working and not.
Your 2nd hint was right on target. There should be a notice in the manual, I'd offer as an improvement.
I had added a load/save dialog that would initialize the list of available save games. It is well possible that with a bit of cleanup work I did in the UI parts, Unity suddenly decided to evaluate that before the Save System. Disabled it for testing and voila, everything works again. So I'll make that thing init when it's first shown, not on start.
Your 2nd hint was right on target. There should be a notice in the manual, I'd offer as an improvement.
I had added a load/save dialog that would initialize the list of available save games. It is well possible that with a bit of cleanup work I did in the UI parts, Unity suddenly decided to evaluate that before the Save System. Disabled it for testing and voila, everything works again. So I'll make that thing init when it's first shown, not on start.
-
- Posts: 150
- Joined: Mon Nov 23, 2020 6:35 am
Re: Save System Disappears
And let me say Thanks again - your support is glorious !
Re: Save System Disappears
Glad to help! I'll check the script execution order and probably make sure that SaveSystem's Awake runs a little earlier so it finishes before default scripts.