Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

c# - How to update a JSON file from Unity and send it back to the server

I am a game developer, but I am new to web development with JSON. However, I am trying to learn how to implements an online high score system by using a JSON file stored on my web host server with a Unity project. So far, I can get user names and their scores from the remote JSON file by using the WWW class in Unity. However, I am not sure what would be the best way to update existing /add new pairs of data to the JSON file. I have been seeking for proper documents/tutorials online for hours, but I didn't find one that works for me. Can anyone please provides some hints and suggestions for doing this from both client side(Unity) and server side? Thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Check on the link below the library for JSON manipulation

http://wiki.unity3d.com/index.php/SimpleJSON

SimpleJSON is an easy to use JSON parser and builder.

http://wiki.unity3d.com/index.php?title=JSONObject

JSONObject : Decode JSON-formatted strings into a usable data structure, Encode structured data into a JSON-formatted string, Interoperable with Dictionary and WWWForm

Both libraries allows you to edit existing values and add new ones to your original JSON

To send your JSON back to the server you can use WWWForm : http://docs.unity3d.com/ScriptReference/WWWForm.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...