0
Answered

Autoload the saved profile at startup.

Pandar 6 months ago in Game Creator updated 6 months ago 3

Hi. I don't have any Save – Load buttons in my project. I hid the save in the Exit button. And how to properly organize the loading of the saved game profile at the start (without a button)? Put the “On Start” trigger with “action Load” in the scene – it doesn't work for me – the load loops.

Unity version:
Game Creator version:

Answer

Answer
Answered

This is an interesting question. The loop is expected, and here's why: You have SceneA with a Trigger that, On Start, it loads the previously saved game. This save, loads the saved scene which is SceneA, and the On Start Trigger fires again, entering an endless loop.

The way to break this is bu having an initial scene that handles the loading part. Let's call it "FirstScene". This scene should start with a Trigger on start that checks if a game has been previously saved. If so, use the Load Game. If not, load the first scene in your game.

This means that the "FirstScene" scene will only be active for a fraction of a second at the beginning of the game, and there's no way to save the game in that scene. So, its only purpose is to load a saved game.

Hope this makes sense. If you have questions about this setup, feel free to reopen the thread.

Answer
Answered

This is an interesting question. The loop is expected, and here's why: You have SceneA with a Trigger that, On Start, it loads the previously saved game. This save, loads the saved scene which is SceneA, and the On Start Trigger fires again, entering an endless loop.

The way to break this is bu having an initial scene that handles the loading part. Let's call it "FirstScene". This scene should start with a Trigger on start that checks if a game has been previously saved. If so, use the Load Game. If not, load the first scene in your game.

This means that the "FirstScene" scene will only be active for a fraction of a second at the beginning of the game, and there's no way to save the game in that scene. So, its only purpose is to load a saved game.

Hope this makes sense. If you have questions about this setup, feel free to reopen the thread.

Thanks! This is how it works. But there is another problem. It seems that not all data is loaded the first time. If you click the Load button a second time, it loads the rest.

Loads the last three variables the first time and does not load the "Lock Level 1, 2, 3" variables."

+1

Apologize. I solved the problem. Thank you for your answers.