Quantcast
Channel: Questions in topic: "playerprefs"
Viewing all articles
Browse latest Browse all 1333

How to add playerPrefs to this script?

$
0
0
Hi there I know this is very newbie, but its really urgent that I get help with this please :) I have a menu Scene that has 9 Gui buttons with attached Textures to them and when clicked they take you to the relevant level.However they are all unlocked which makes the game pointless! How would I go about adding PlayerPrefs to allow a level unlocking system. So from start of game only level one is not Greyed Out. After completing Lvl 1 then Lvl 2 is un-greyed and clickable and so on. Thanks in advance , I am really battling with PlayerPrefs. Here's The JS script: public var button1 : Texture2D; public var Button2 : Texture2D; public var Button3 : Texture2D; public var Button4 : Texture2D; public var Button5 : Texture2D; public var Button6 : Texture2D; public var Button7 : Texture2D; public var Button8 : Texture2D; public var Button9 : Texture2D; public var Button10 : Texture2D; var btnTexture : Texture; // JavaScript function OnGUI () { // Make a background box // Make the first button. If it is pressed, Application.Loadlevel (1) GUI.Box (Rect (1,200,1300,480),"Trial Version V1.0 Copyrite of GenY Tech Limited ©"); if (GUI.Button (Rect (10,230,200,200), button1)){ Application.LoadLevel(3); } if (GUI.Button (Rect (225,230,200,200), Button2)){ Application.LoadLevel (4); } if (GUI.Button (Rect (440,230,200,200), Button3)){ Application.LoadLevel (5); } if (GUI.Button (Rect (655,230,200,200), Button4)){ Application.LoadLevel (8); Handheld.Vibrate(); } if (GUI.Button (Rect (870,230,200,200), Button5)){ Application.LoadLevel (9); Handheld.Vibrate(); } if (GUI.Button (Rect (1085,230,200,200), Button6)){ Application.LoadLevel (10); Handheld.Vibrate(); } if (GUI.Button (Rect (250,10,900,100), btnTexture)){ Application.LoadLevel(1); } if (GUI.Button (Rect (10,440,200,200), Button7)){ Application.LoadLevel(11); } if (GUI.Button (Rect (225,440,200,200), Button8)){ Application.LoadLevel (12); } if (GUI.Button (Rect (440,440,200,200), Button9)){ Application.LoadLevel (13); } if (GUI.Button (Rect (655,440,200,200), Button10)){ Application.LoadLevel (6); Handheld.Vibrate(); } }

Viewing all articles
Browse latest Browse all 1333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>