Ok, editing this to make it much more concise. Here are the basics:
I’m using a save / load script which works, except I need to plug in more variables. In other words, the script is designed from the go to save player position, but nothing else. So I’m trying to call stats from a couple of different scripts for saving (such as current health, experience, etc.) with no success. Below is a small chunk of the script, the area I’ve identified as being pertinent to this question. (I realize that with my lack of experience I may be completely wrong)
//LoadingPlayers ************************************************************
if (GUI.Button(_Load,"Load")) {
GUI.Label(_LoadMSG,"Loading from: "+_FileLocation);
// Load our UserData into myData
LoadXML();
if(_data.ToString() != "")
{
myData = DeserializeObject(_data);
VPosition=new Vector3(myData._iUser.x,myData._iUser.y,myData._iUser.z);
player.transform.position=VPosition;
curExperience = Playerhealth.curXp;
Debug.Log("Load Successful");
}
}
//EndOfLoadingPlayers *******************************************************
//SavingPlayers *************************************************************
if (GUI.Button(_Save,"Save")) {
GUI.Label(_SaveMSG,"Saving to: "+_FileLocation);
//Debug.Log("SaveLoadXML: sanity check:"+ player.transform.position.x);
myData._iUser.x = player.transform.position.x;
myData._iUser.y = player.transform.position.y;
myData._iUser.z = player.transform.position.z;
myData._iUser.name = playerName;
myData._iUser.curExperience = Playerhealth.curXp;
myData._iUser.curExperience = Playerhealth.curHealth;
Look directly above. The last two lines are what I modified to try and pull from those two scripts, whereas everything preceding those are original, before I modified anything. AND… nothing changes. Player position loads fine, but nothing I tried to save. There is much more to the script, and maybe a variable needs to be saved somewhere, I don’t know. I can place the entire script in a couple of comments below, if necessary. Thanks to anyone who is able to help me with this problem, which has me pulling my hair out. God bless.