Storing data from different scenes

I was just wondering if this was possible… I have a few items that I want to be kept with the character throughtout the scenes… Is that possible maybe with an array or something?(: Thanks!

Check this out, this ought to do the job Object.DontDestroyOnLoad.

Create an script called “levelPersistent”

#pragma strict
public class levelPersistent extends MonoBehaviour
{

var myspecialnumber:int=0;

function getMySpecialNumber(): int
{
return(myspecialnumber);
}

function setMySpecialNumber(no:int)
{
myspecialnumber=no;
}

}

That’s the script where you can keep everything you want between levels. In your management object call the following to initialize the object.

function initialisePersistent()
{
if (!GameObject.Find("Persistent"))
	{
	Debug.Log("Create Persistent Object");
	var obj : GameObject;
	obj = new GameObject("Persistent");
	obj.AddComponent("levelPersistent");
	DontDestroyOnLoad(obj);
	
	}

}

An easy way to do this is to store the data in static variables. You could create a script like this:

public class GameData
{
public static int CharacterLevel;
public static string CharacterTitle;
public static float CharacterSpeed;
}

Then anywhere in the game you can access them like this:

currentLevel = GameData.CharacterLevel