🔒 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.

Similar threads

About this Thread

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

Online now

Members online
501
Guests online
3,804
Total visitors
4,305

Forum statistics

Threads
2,349,675
Posts
29,363,688
Members
1,091,259
Latest member
kirtxy
Back
Top