Save Scale
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
Its just a yellow warning not an actual red error. Yeah all the scenes are in my build. It goes from the patching system to the menu to then my actual levels of 1 through 5. The patcher Im still hashing out problems with but the menu scene is a simple page. I didnt figure the save would work inside of the editor like that. Lol it works in the editor but not in the build. :/
Re: Save Scale
Try playing in the editor from the very first scene in build settings. Maybe an earlier scene has a differently-configured Save System GameObject. During play, the first Save System GameObjects to appear in your playthrough will survive scene changes and replace any Save System GameObjects in subsequent scenes. If that first Save System GameObject isn't configured right, it could cause problems. In addition, if you try to use any Save System functions before a Save System GameObject exists, the Save System will be forced to create a default Save System GameObject which may not be configured the way you need. It's easiest to put your Save System GameObject in the first scene in build settings.
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
Ok so I have a patch system which is on scene 0 then the game menu on scene 1 then level one on scene 2. I have been starting the editor on level one aka scene 2. There isnt a save game system object in scene 1. So I need to move the save game system object to scene 1 so it moves as the game proceeds. Correct?
Re: Save Scale
Hi,
Yes, please move the Save System GameObject to scene 1 or even scene 0.
Yes, please move the Save System GameObject to scene 1 or even scene 0.
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
I moved it to the game menu and now things save BUT all my doors save in the opened state instead of the closed state. Thats a custom script in the suburb pack Im using so I need to figure out why its saving them all opened. Thanks Tony!
Re: Save Scale
I'm glad the save system's working now. If the door saver script is a custom Saver script (i.e., a subclass of the Save System's Saver script), make sure all of the instances in the scene(s) have unique Key values. You can use the menu item Tools > Pixel Crushers > Common > Save System > Assign Unique Keys to make them unique.
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
I thought as long as the script was on different game objects they could be the same and just had to be different if on the same game object. Thanks again you just saved me hours of looking
Re: Save Scale
Glad to help! Think of the game's save data as a single big dictionary, where each Saver component saves its state to a unique key.
-
- Posts: 44
- Joined: Sun Feb 20, 2022 5:53 pm
Re: Save Scale
And it spans across the scenes so each save item in each scene needs to be different and not one identical key?
Re: Save Scale
Yes, in general savers should have a unique key across the entire game. The only exception is if you want to share data across scenes, which is most common for player savers. For example, you probably want to save the player's health in a key when leaving scene 1 to go to scene 2, and then restore that same saved health when you're in scene 2. In this case, use the same key for the player health savers in scenes 1 & 2.
There may be savers that only need to keep their save data in the current scene. For example, if an enemy shoots an arrow at the player, and the player saves the game while the arrow is in mid-air, you'll want to save the arrow position while the player is in that scene. But if the player moves to another scene, there's no need to bloat the saved game data with the arrow's position. In this case, you can untick the saver's Save Across Scene Changes, and you can reuse the key in other scenes.
There may be savers that only need to keep their save data in the current scene. For example, if an enemy shoots an arrow at the player, and the player saves the game while the arrow is in mid-air, you'll want to save the arrow position while the player is in that scene. But if the player moves to another scene, there's no need to bloat the saved game data with the arrow's position. In this case, you can untick the saver's Save Across Scene Changes, and you can reuse the key in other scenes.