Help with Object position and state, save and load.

Hi, I have a number of “brick” prefabs in my scene (cubes with explosion script and scoretrigger scripts)

I have 4 prefabs, (all the bricks have been manually placed into my scene): bluebrick, greenbrick, redbrick & yellowbrick. Each are tagged with “brick”.

What I want to be able to do is, when the player saves (from my pause menu), it stores each brick’s position on screen and if it is destroyed or still there.

for example; if the player is playing and destroys 25/100 bricks and then saves the game, quits and reloads, the level will load and the 25/100 bricks will still be destroyed.

I have been searching for about a week and i’m just lost. Is there a way using PlayerPrefs to just save:

  1. the position of the bricks.
  2. whether it is there in scene or already been destroyed.

The latest thing I tried was using this script:

http://gamingirresponsibly.com/megabite-24-saving-and-loading

as you can see from my comment this didn’t work out lol arrrgh!

please help

Solved by using Unity Serializer to store the position and existence of the bricks and added script to the pause menu to save and load the game.

var paused : boolean = false; 
var pausedGUI : GUITexture;  

pausedGUI.enabled = false;

function Update () 
{ 
    if(Input.GetKeyUp(KeyCode.P))
    { 
       paused = !paused;

        if(paused == true){
            Time.timeScale = 0.0;
            pausedGUI.enabled = true;
        } else {
            Time.timeScale = 1.0;
            pausedGUI.enabled = false;
        }
   }
}

function OnGUI() {
    if(!paused)
       return;

    var box : GUIStyle = "box";   
    GUILayout.BeginArea(Rect( Screen.width/2 - 200,Screen.height/2 - 300, 400, 600), box);

    GUILayout.BeginVertical(); 
    GUILayout.FlexibleSpace();
    if(GUILayout.Button("Save Game"))
    {
       LevelSerializer.SaveGame("BrickGame", false, null);
    }
    GUILayout.Space(60);
    for(var sg in LevelSerializer.SavedGames[LevelSerializer.PlayerName]) { 
       if(GUILayout.Button(sg.Caption)) { 
         sg.Load(); 
         Time.timeScale = 1;
         } 
    } 
    GUILayout.FlexibleSpace();
    GUILayout.EndVertical();
    GUILayout.EndArea();


}