For some reason the character’s name will not save when I hit the “finish” button, what could be wrong?
var CharacterName : String = "Hello World";
function OnGUI(){
CharacterCreater();
FinishedWithCharacter();
}
function CharacterCreater() {
CharacterName = GUI.TextField (Rect (10, 10, 200, 20), CharacterName, 25);
}
function FinishedWithCharacter(){
if(GUI.Button(Rect(300,10,50,20), "Finish")){
SaveGame();
}
}
function SaveGame(){
Debug.Log("Saving Game...");
PlayerPrefs.SetString("PlayerName", CharacterName);
}