Restarting my game main menu

Tathunder 3 months ago in Game Creator updated 3 months ago 10

I have a main menu and a number of scenes. I am planning on working out loading and saving games later.

The problem that I have at the moment is restarting a new game from scratch.

I can start a new game from the main menu that loads my first scene after the main menu.

If I then return to the main menu (from my ingame menu)and click on start new game it loads the scene again but attributes/weight/currency/inventory all persist from the first play.

I have saving turned off in the preferences and I have tried loading scenes with and without async but it does not make a difference.

How can I effectively restart a new game from scratch? 

I have onstart triggers that reset my attributes/weight/currency effectively. I also have a dump inventory to container that does not work; I have the container selected to gameobject and a container to dump inventory in, but it keeps throwing me an error in the console and only removing one stack in the inventoy and leaving the rest to remain.

If I could learn a better way to restart my game from scratch it would be much better.

I just cant seem to find it in the documentation.

Sorry if I have missed something again.

Many thanks for any help.

Unity version:
Game Creator version:

OK, so I figured it out.

It was a matter of using the profile system. In my main menu on the new game button, before I load my first scene, I load profile2, delete profile1, then load profile 1 again.

That seems to do the trick.

Right, now I am very confused. It is only working after playing on the first level. If I try to restart from later levels stats inventory weight currency are all remaining despite my onstart triggers that are supposed to reset them all AND switching and deleting profiles when clicking the start new game button.

I have been testing and my problem is only happening when I have saved a game on that game session and if a stat has changed(been upgraded) on that game profile that I have saved the game. But it does not appear if I save my game on the first level for some reason that evades me, only on later scenes.

The errors in the console, so far, only happen in this situation.

if a player was to play, save then fully quit the game: the errors would not be apparent if they started the game again and wished to play a new game from the beginning. But, if they play, save then want to start a new game from scratch the new start has them having greater stats than intended and items in the inventory that should not be there.

It could be an exploit.

another screen of the editor and console. You can see in the top right corner of the scene window that there is a "water" variable showing an attribute value/300. On a new game the stat should be 100 not 300. It is persisting somehow despite onstart triggers resetting it and actions on the newgame button(in the main menu scene) that change the profile, delete the profile and then change back to the profile. The saved game is on a completely different profile so I can't understand why the it is persisting.

this screen shows my onstart action that are supposed to reset everything on a new game.

This shows my main menu, you can see my actions on my startnew game button.

The reason I am switching to profile 2 before I delete profile1, is because it works for making the game restart correctly. Otherwise a lot more is not restarting as I wish, across all scenes that I play on. No matter what stats have increased.

Please help.

Ok, the minute I asked for help on Discord I figured out a workaround.

I added a wait of 1 sec on my on load and on start triggers, that I mentioned before, that I am using to reset everything...

...and voila, it's now working.

I do still think there may be an issue with the profile system however. Should these values persist on a new profile after it has been deleted?

I am starting to think there is a problem on my end, but I can't understand why I am only having these specific problems.

I have realized that my player's position should be saving automatically, but on load my player always appears at the default scene position. I have reinstalled GC1.1.8 and updated unity from 2018.4.19f to 2018.4.23f1 LTS. And my player is still saving without saving its position. Not sure what else I can try.