Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by badwolfman · May 11, 2020 at 08:19 AM · uimenusave datadropdownsave game

Trouble loading game save data with BlazeSave after uploading a new Steam build

First time posting here, and feeling like my C# skills are pretty rudimentory. I am working on my first game BioEntity, a 2D platformer to release on Steam for Windows and macOS.

I was previously using PlayerPrefs to save game data, but I recently implemented BlazeSave to persistently save user data when I build in Unity and then upload to Steam. Saves are stored within the 'Saves' folder in the main project folder alongside 'Assets' and 'Library.' This works in the Unity Editor.

However, uploading new builds to Steamworks and downloading the update does NOT allow me to access my old save game folders. Code should grey out the 'Continue' button if there are no Saves and make it active (green) if the 'Saves' folder contains any subfolders (containing save game data files). When you click 'Continue', a UI Dropdown menu should populate with the names of all the sub directories inside of 'Saves', so you can select your save game file and load it.

Instead, 'Continue' is active but shows the default options (blank), not the save names. alt text alt text Only after I create a new game does it then appear in the Continue dropdown menu.

The idea is that pushing a new build to Steamworks should not erase or overwrite existing save game folders; they should persistently stay within 'Saves.'

Here is the relevant code from MainMenu.cs that runs at the start of the game:

 public int levelBeaten;
 public GameObject audioFade;
 public AudioSource audioSource;
 
 public GameObject NewGameButton;
 public GameObject ContinueButton;
 public GameObject HowToPlayButton;
 public GameObject ControlsButton;
 public GameObject ExtrasButton;
 
 public GameObject AreYouSure;
 public GameObject NewGameWindow;
 public GameObject YesButton;
 public GameObject NoButton;
 public GameObject StartButton;
 public GameObject BackButton;
 public GameObject InputField;
 public GameObject ContinueWindow;
 
 public Dropdown saveGameFolders;
 
 public AudioClip labMusic;
 
 string lastSelected;
 
 Text SaveName;
 
 DirectoryInfo dir;
 DirectoryInfo[] info;
 
 void Awake()
     {
         SaveSystem.Load();
 
         //Load the highest level beaten from Preferences
         levelBeaten = SaveSystem.levelBeaten;
 
         //Hide the Continue Window
         ContinueWindow.SetActive(false);
 
         //Get the Save Directory
         dir = new DirectoryInfo(System.IO.Directory.GetCurrentDirectory() + "\\Saves");
         info = dir.GetDirectories();
 
         Debug.Log("Dir: " + dir);
 
         //If no saves, set 'Continue' to grey and select New Game Button. If there are saves, set to green and select Continue BUtton.
         if (info.Length == 0)
         {
             EventSystem.current.SetSelectedGameObject(NewGameButton);
             Text continueText = ContinueButton.GetComponentInChildren<Text>();
             continueText.color = new Color(0.5f, 0.5f, 0.5f);
         }
         else
         {
             EventSystem.current.SetSelectedGameObject(ContinueButton);
             Text continueText = ContinueButton.GetComponentInChildren<Text>();
             continueText.color = new Color(0f, 1f, 0f);
         }
     }
 
 public void LoadGameWindow()
     {
         ContinueWindow.SetActive(true);
 
         if (info.Length == 0)
         {
             ContinueWindow.SetActive(false);
             EventSystem.current.SetSelectedGameObject(ContinueButton);
         } else {
 
             //Clear the Save Games dropdown menu
             saveGameFolders.ClearOptions();
 
             //For each folder in the Save directory, load the name as a dropdown menu item
             foreach (DirectoryInfo f in info)
             {
                 Debug.Log("Save Folder: " + f);
 
                 Dropdown.OptionData saveGameName = new Dropdown.OptionData();
                 string saveNameDisplay = Path.GetFileName(f.ToString());
                 saveGameName.text = "" + saveNameDisplay;
                 //saveGameName.text = "" + f;
                 saveGameFolders.options.Add(saveGameName);
             }
 
         saveGameFolders.value = -1;
 
         EventSystem.current.SetSelectedGameObject(StartButton);
         }
     }
 
 public void LoadGame()
     {
         //Load from /Saves/[the selected dropdown item]
         SaveSystem.SaveName = "Saves/" + saveGameFolders.options[saveGameFolders.value].text;
 
         Debug.Log("Save Folder:" + SaveSystem.SaveName);
         Debug.Log("SaveName = " + SaveName);
 
         //Load from SaveSystem and go to the Minimap scene
         SaveSystem.Load();
         SceneManager.LoadScene("Blob-Minimap", LoadSceneMode.Single);
     }

And SaveSystem.cs looks like this:

 public static int levelBeaten;
 public static int currentLevel;
 ...
 
 public static void NewGame()
     {
         currentLevel = 1;
         levelBeaten = 0;
         ...
     }
 
 public static void Load()
     {
         levelBeaten = BlazeSave.LoadData<int>("LevelBeaten.bin", SaveName, null, true);
         currentLevel = BlazeSave.LoadData<int>("CurrentLevel.bin", SaveName, null, true);
         ...
     }
 
 public static void Save()
     {
         BlazeSave.SaveData("LevelBeaten.bin", levelBeaten, SaveName, null, true);
         BlazeSave.SaveData("CurrentLevel.bin", currentLevel, SaveName, null, true);
         ...
     }

I really appreciate any help I can get on properly implementing save games; this has been a constant source of frustration for me. I am super worried that I will release my game and any patches will prevent players from loading their save games.

Thanks!

main-menu-continue-button.png (32.4 kB)
main-menu-save-game-menu-empty.png (67.0 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by badwolfman · Jun 14, 2020 at 10:06 PM

Any ideas about this?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

289 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Writing dropdown selections to file 1 Answer

Options menu won't work 0 Answers

How can I set up an in-game menu? 1 Answer

How to make folding menu? 0 Answers

DropDownList don't close at game paused 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges