Easy save wont ignore a value and sets it to empty instead
Posted: Tue Aug 09, 2022 7:42 pm
Hi there, I have a script that I will post below, I have an es3 type setup for each of the classes in it and the parent class itself and mostly it works fine however there are several ui fields in the class that are setup that I want es3 to ignore so I did not add them to the type however when using load or load into on this script it keeps setting the values to empty and overriding the default. I have tried using the es3 non serializable attribute but nothing works, how can I get it to stop touching these values and only amend the ones that are active in the es3 type.
Here is my class, the ones I am having issues with is everything inside the UI class, these values are all set inside the inspector and should never need to be saved or changed. Thanks.
public class Player_Stats : MonoBehaviour
{
public GameObject xpBar;
public Image mask;
public TextMeshProUGUI levelUi;
//Variables
//Player rank
public int playerRank = 1;
public float currentXp;
public float xpToRank = 250;
private float xpMultiplier = 1.2f;
[System.Serializable]
public class Reputation
{
public float millitaryRep;
public float runnerRep;
public float hollowedRep;
public bool hostileToAll;
}
public Reputation reputation;
[System.Serializable]
public class Skills
{
public List<Player_Skills> pSkills = new List<Player_Skills>();
public int availableSkillPoints;
[System.Serializable]
public class UI
{
public List<GameObject> skillAddIcons = new List<GameObject>();
public List<Image> skillFills = new List<Image>();
public TextMeshProUGUI skillPointsIndicator;
}
public UI uiElemts;
}
public Skills skills;
Here is my class, the ones I am having issues with is everything inside the UI class, these values are all set inside the inspector and should never need to be saved or changed. Thanks.
public class Player_Stats : MonoBehaviour
{
public GameObject xpBar;
public Image mask;
public TextMeshProUGUI levelUi;
//Variables
//Player rank
public int playerRank = 1;
public float currentXp;
public float xpToRank = 250;
private float xpMultiplier = 1.2f;
[System.Serializable]
public class Reputation
{
public float millitaryRep;
public float runnerRep;
public float hollowedRep;
public bool hostileToAll;
}
public Reputation reputation;
[System.Serializable]
public class Skills
{
public List<Player_Skills> pSkills = new List<Player_Skills>();
public int availableSkillPoints;
[System.Serializable]
public class UI
{
public List<GameObject> skillAddIcons = new List<GameObject>();
public List<Image> skillFills = new List<Image>();
public TextMeshProUGUI skillPointsIndicator;
}
public UI uiElemts;
}
public Skills skills;