The Initial Variables are set prior to the start menu when the game is initialized. The Help text says the variables will be kept when starting a new game..." The initial variables appear to be initialized again after choosing new game and then the difficulty level.

In my case they are initialized as floats with a value of 1. I adjust them in the start menu say to .3 and .4 and .5 as an example. They reset back to 1 when I start a new game (and choose a difficulty level).
  • Yes, global variables are currently initialized when starting a new game, and they're also completely removed and reinitialized when stopping the game (e.g. also on game over or when returning to the start menu).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • To be clear: They are initialized prior to the start menu. They are initialized again when new game is chosen. The values set in the start menu get reset when this happens. I would like to keep the values that were set in the start menu. Is this possible?
  • Currently not. I'll look into it.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I'll try to think of another solution option as well. Basically what I am doing is using the initial variables for some custom sound options. So the data set at the start menu is carried over to the game. I was confused as the help information on Makinom says "The variables will be kept when starting a new game - but keep in mind that loading a saved game will clear all previous variables." I thought that meant they would retain their values when starting a new game.

    Basically, I'm looking for a variable that I can initialize at the start menu and then keep track of that value throughout the game including saves. Maybe I just need to make an auto machine in the start menu scene and have that run at start to set some global variables and use those instead of Initial Variables. I do some more testing. Thank you for your help!
  • I removed the options from the Start Menu and moved them to the options menu after a New Game is created. This is probably the easiest way to handle this.
  • Currently, you can only use PlayerPrefs for options that are independent of the game's variables. This'd also make them independent of the save game, e.g. sharing options across them all.
    In UI > Save Game Settings you also have options to save game options like language and volumes into PlayerPrefs as well.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.