🔒 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
  • 549
    Views
  • 1
    Participants
Last reply from:
H20_Waterr

Trending Topics

Online now

Members online
711
Guests online
3,137
Total visitors
3,848

Forum statistics

Threads
2,328,489
Posts
29,242,598
Members
1,159,829
Latest member
Kieioq
Back
Top