🔒 Closed Unity C# Json Deserialization problem

Status
Not open for further replies.

H20_Waterr

Honorary Poster
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.
 
Status
Not open for further replies.

About this Thread

  • 0
    Replies
  • 515
    Views
  • 1
    Participants
Last reply from:
H20_Waterr

Trending Topics

Online now

Members online
1,039
Guests online
1,470
Total visitors
2,509

Forum statistics

Threads
2,278,181
Posts
28,981,411
Members
1,228,256
Latest member
runicblade456
Back
Top