I'm fairly new to c# and unity. I am attempting to get variables from my json files but the program seems to only return booleans and strings properly.
c#
public class Reputation
{
public int normal { get; set; }
}
void Start()
{
string reputation = @"c:\path\to\file\reputation.json";
StreamReader reader2 = new StreamReader (reputation);
player.reputation = JsonUtility.FromJson<Reputation>(reader2.ReadToEnd ());
reader.Close ();
Debug.Log(player.reputation.normal);
}
json
{
"normal":20
}
and the log displays a 0