- Home /
How to save a multpile choice?
Im going to make this simple.
I've made a multiple choice button here it is :
-Function Update () { print ("Hello") } -Function OnGUI() if (GUI.Button(Rect(20,40,100,40),'Hello')) { var answer1=print ("How are you?"); answer1.rendrer.enabled=true;
}}
-Function OnGUI() if (GUI.Button(Rect(20,60,100,40),'sorry I haven't got time')) { var answer1=print ("ok, bye."); answer1.rendrer.enabled=true;
}}
Ok before any comment shows up, I'm aware that my script is wrong. (and if someone can correct it, I thank him for that, it'll be of great help)
But that is not what I want know.
I just want to know how is it possible to save this "function" or choice?
I mean I want to make a rewind button, in the game, that will allow player to come back to another choice option he already made.
Like a save game.
I'm taking this idea from this game: http://ded.increpare.com/~locus/Detective_Clean/
Try it, and try the rewind button you'll understand what I mean.
I want to know how I can save this multiple choice as per exemple "choice 1" and get back to it if i choose in the game to rewind to choice 1.
Thanks
Answer by Unamine · Feb 15, 2011 at 09:42 PM
Actually the script is wrong, do not know if the logic, but look at the: rendrer, the renderer would be correct.
You can use PlayerPrefs to record a variable the value of something, look in your manual offline. Go to Help Menu in Unity > Unity Manual, Scripting and choose Scripting and type PlayerPrefs but also look at the videos of Zerg Burg Arcade:
- Unity3D Tutorial - PlayerPrefs 1 / x
- Unity3D Tutorial - PlayerPrefs 2 / x
- Unity3D Tutorial - PlayerPrefs 3 / x
- Unity3D Tutorial - PlayerPrefs 4 / x
- Unity3D Tutorial - PlayerPrefs 5 / x
- Unity3D Tutorial - PlayerPrefs 6 / x
Link to site: http://www.burgzergarcade.com/hack-slash-rpg-unity3d-game-engine-tutorial
ok i will try.
And i know that the script is wrong, its just to show an exemple.
Your answer
Follow this Question
Related Questions
Multiple functions in a single button not working 1 Answer
Action executed with more than one key? 1 Answer
Pause Button Menu loader 2 Answers
End/Pause Game! 2 Answers
Creating a Multiple Choice Game 2 Answers