Skip to main content
2 of 3
added 555 characters in body
Jon
  • 3.7k
  • 1
  • 14
  • 23
public SaveInformation _Info = new SaveInformation(); //Move into class-scope
public void Start()
...
public void isBarbarian()
{
   //This is destroyed when isBarbarian returns
   SaveInformation _Info = new SaveInformation();
   ...
}

//When you make changes to your .NET assemblies, Unity copies the existing
//data to the un-managed side, reloads the new assemblies, then copies the
//data back. Classes you create are not serializable, by default, so Unity
//will not be able to "see" them. This is also required since this
//SaveInformation is probably going to be.... saved (serialized to disk)
[System.Serializable] //This allows Unity to "see"
class SaveInformation
{
   public float PublicFloat1; //Serialized

   [NonSerialized]
   public float PublicFloat2; //Not serialized

   private float PrivateFloat1; //Not serialized

   [SerializeField]
   private float PrivateFloat2; //Serialized
   ...
}
Jon
  • 3.7k
  • 1
  • 14
  • 23