Keeping stats from level to level (scene to scene)

Hello,

I am working on a 2.5D platformer where the player can collect and lose lives. I have a script that keep track of the number of lives, but once the player reach a new level (wich is a new scene), the number of lives is reset to the "starting" value of the script.

Is there a way to make Unity "remember" the number of lives from scene to scene?

Thanks,

gaboumafou

I'll be nice =)

http://answers.unity3d.com/questions/5736/scene-to-scene-variables

Hum... I tried applying a DontDestroyOnLoad on the script keeping track of the number of lives, but the number of lives is still reset to 4 after each level load.

Here is my script (please keep in mind that I am not a programmer and that I mostly "recycle" scripts from tutorials and forum answers)

static var charge : int = 4;

var charge1tex : Texture2D; var charge2tex : Texture2D; var charge3tex : Texture2D; var charge4tex : Texture2D; var charge5tex : Texture2D; var charge6tex : Texture2D; var charge7tex : Texture2D; var charge8tex : Texture2D; var charge9tex : Texture2D; var charge10tex : Texture2D; var charge11tex : Texture2D; var charge0tex : Texture2D;

function Start(){ guiTexture.enabled = true; charge = 4; }

function Awake () { DontDestroyOnLoad (this); }

function Update () { if(charge == 1){ guiTexture.texture = charge1tex; guiTexture.enabled = true; } else if(charge == 2){ guiTexture.texture = charge2tex; } else if(charge == 3){ guiTexture.texture = charge3tex;

`}

else if(charge == 4){
guiTexture.texture = charge4tex;

}
else if(charge == 5){
guiTexture.texture = charge5tex;

}
else if(charge == 6){
guiTexture.texture = charge6tex;

}
else if(charge == 7){
guiTexture.texture = charge7tex;

}
else if(charge == 8){
guiTexture.texture = charge8tex;

}
else if(charge == 9){
guiTexture.texture = charge9tex;

}
else if(charge == 10){
guiTexture.texture = charge10tex;

}

else if(charge == 11){
guiTexture.texture = charge11tex;

}

else{
guiTexture.texture = charge0tex;
}
`

}