Hello , Im having a problem with save/load , It seems like the Getcomponent aint working , Cant figure out whats wrong
var derpsave:int=0;
var derpload:int=0;
function SaveCharacter(info : String[]) //0=LEVEL | 1=EXP| 2=Name//
{
var object:GameObject;
object=GameObject.Find(info[2]);
var Playerscript=object.GetComponent("PlayerScript");
var Level : float= parseFloat(info[0]);
var Experience : float= parseFloat(info[1]);
PlayerPrefs.SetInt("Level", Level);
PlayerPrefs.SetInt("Experience",Experience);
derpsave=1;
}
function LoadCharacter(Player:String)
{
var object:GameObject;
object=GameObject.Find(Player);
var Playerscript=object.GetComponent("PlayerScript");
Playerscript.Level=PlayerPrefs.GetInt("Level");
Playerscript.Experience=PlayerPrefs.GetInt("Experience");
print (PlayerPrefs.GetString("Level"+"lol"));
print (PlayerPrefs.GetString("Experience"+"lol"));
derpload=1;
}
If i comment out everything inside the functions except Derpload / derpsave , It works