Collectables across multiple levels

I’m creating a project where the objective is to find objects in separate levels, however apart from having a GameObject that doesn’t get destroyed I’m unsure where to go from here. I need a system that goes checks a database when loading a level and only creates the collectables that have not been found yet or destroys the collectables in the level that have already been found once the level is loaded.

alt text

Can anyone point me in the direction of a good place to start? The system needs to work on all of the mobile platforms (Windows Phone, iOS, Android, and Blackberry 10) and be possible in JS. I’ve read a bit about XML files however most tutorials are not built for those who are a newcomers of XML.

[Edit for Clarity]
When I say database I meant a local file that stores the data for an object in the scene, basically in Unity I have 5 levels, in each level there are 3 collectables. When a level is loaded I want to have an array of GameObject called Collectables in a GameController object and use GameObject.FindGameObjectsWithTag("Collectable"); to populate that array. After that is done I want to read some sort of data file, the file needs to have an ID number for each level to only check the data that corresponds with the the id of the current level in Unity and an ID for each collectable, and then go through the data for each Collectable from the file, if a Collectable has the IsCollected value of true then it should destroy the GameObject from the Collectables array in the scene. I’ve done my best to write an XML that best portrays what I need in the data Here.

Give a unique name for each collectable, and put script like this:

function Awake() {
	if (PlayerPrefs.GetString("collectables.", "false") == "true") {

// it could be called directly or replaced by a trigger event
function Collect() {
	PlayerPrefs.SetString("collectables.", "true");

After you call Collect, it will register on playerprefs and it will self destroy on awake.

Some usefull references:


Colliders and triggers

You can look at my series of questions I did some time ago:

Here is how to access and update db:

Then you need to collect the info into a class and check what the player has done.

if(level1 == Level.Done){//Allow access to level 1}
if(level2 == Level.Done){//Allow access to level 2}

The rest is always the same, has he done it, if yes, allow something.

All you need is to get the script from the link working.