how do i do an achievements screen?

in my game level i have 2 scripts that show notifications in game when i collect objects for the achievements.

in the main menu i want a screen that shows the achievements locked until the notification shows in the level.

how do i do this and will this be affected by the fact that when i go back to the main menu the level starts over again losing what i had previously collected.

this is my 2 achievements scripts:

file 1:

var state:int = 0;
var scrollSpeed:float = 250;
var showAchievementTime:float = 5;

private var targetX:float;
private var outOfScreenX:float;
private var guitex:GUITexture;
var edgeMargin:float;

function Start(){
	guitex = GetComponent(GUITexture);
	outOfScreenX = guitex.pixelInset.x;
	targetX = Screen.width - guitex.texture.width - edgeMargin;
	yield WaitForSeconds(showAchievementTime);
	state = 1;
	yield WaitForSeconds(showAchievementTime);

function Update () {
	if(state == 0){
		guitex.pixelInset.x = Mathf.MoveTowards(guitex.pixelInset.x, targetX, scrollSpeed * Time.deltaTime);
		guitex.pixelInset.x = Mathf.MoveTowards(guitex.pixelInset.x, outOfScreenX, scrollSpeed * Time.deltaTime);

File 2:

var FirstKeyTex:Texture;
var FifthKeyTex:Texture;
var TenthKeyTex:Texture;
var FirstStepTex:Texture;

private var firstStepTaken:boolean;
private var keys:int;
var edgeMargin;

function Start(){
	edgeMargin = Screen.width * .01;

function playerMoved(){
		firstStepTaken = true;

function pickedUpKey(){
		case 1: unlockAchievement(FirstKeyTex); break;
		case 5: unlockAchievement(FifthKeyTex); break;
		case 10: unlockAchievement(TenthKeyTex); break;

function unlockAchievement(achievementTex:Texture){
	var go:GameObject = new GameObject("Achievement Object");
	go.transform.position = Vector3(0,0,Time.time);
	go.transform.localScale = Vector3(0,0,0);
	var guitex:GUITexture = go.AddComponent(GUITexture);
	guitex.texture = achievementTex;
	guitex.pixelInset.width = achievementTex.width;
	guitex.pixelInset.height = achievementTex.height;
	guitex.pixelInset.x = Screen.width * 1.1;
	guitex.pixelInset.y = Screen.height - achievementTex.height - edgeMargin;
	var achievementScript:AchievementScript = go.AddComponent(AchievementScript);
	achievementScript.edgeMargin = edgeMargin;

If you’re looking for a simple solution for implementing achievements, there are a couple of good Unity Plugins out there that can help make this a ton easier. If you’re looking to export your game to Android, then the Swarm (aka SwarmConnect) plugin is a good choice. Here’s a link to it in the Unity asset store: Swarm Unity Plugin. If you need something for iOS, then there’s the Prime 31 GameCenter plugin for that.

I hope these help make your life easier :).

I think there are a couple other achievement plugins out there as well (try searching the Unity Asset Store for “achievements”) and by all means choose which ever one seems simplest and easiest for your situation.

I realize that the answer provided above may very well be a secondary solution to the issue you’re having, but in the long run it very well might save you time, headache, and hassle.