What's new

C# Unity C# Json Deserialization problem

H20_Waterr

Honorary Poster
Joined
Oct 11, 2017
Posts
408
Solutions
1
Reaction
127
Points
215
My Custom Class
C#:
[Serializable]
public class settings
{
    public int ST_PLYR_ID { get; set; }
    public float ST_DISPLAY_BRIGHTNESS { get; set; }
    public float ST_SOUND_VOLUME { get; set; }
    public float ST_MUSIC_VOLUME { get; set; }
}

Json String na gusto kong eDeserialize sa gawa kong custom class object
JSON:
{"ST_PLYR_ID":"10000","ST_SOUND_VOL":"1","ST_MUSIC_VOL":"1","ST_DISPLAY_BRIGHTNESS":"0.98"}

Code sa pag deserialize ko sa json string
C#:
settings st = JsonConvert.DeserializedObject<settings>(jsonString);

Ang problema po kase pag katapos ko pong e deserialize ang json string ang nagiging value po ng ST_SOUND_VOLUME at ST_MUSIC_VOLUME ay nagiging 0. Patuong naman po sa kung sinong may alam paano to.
 

Similar threads

Back
Top