回答編集履歴

1

スペルミスなどを修正

2020/09/17 02:52

投稿

mingos
mingos

スコア4032

test CHANGED
@@ -56,7 +56,7 @@
56
56
 
57
57
  [System.Serializable]
58
58
 
59
- public class player
59
+ public class Player
60
60
 
61
61
  {
62
62
 
@@ -80,15 +80,17 @@
80
80
 
81
81
 
82
82
 
83
- var quiaData = JsonUtility.FromJson<QuizData>(www.text);
83
+ string jsonStr = "{\"players\":[{\"playerId\":\"a\",\"playerLoc\":\"b\"},{\"playerId\":\"c\",\"playerLoc\":\"d\"},{\"playerId\":\"e\",\"playerLoc\":\"f\"},{\"playerId\":\"g\",\"playerLoc\":\"h\"}]}";
84
84
 
85
+
86
+
87
+ var quizData = JsonUtility.FromJson<QuizData>(jsonStr);
88
+
85
- foreach(var player in quizData.players)
89
+ foreach (var player in quizData.players)
86
90
 
87
91
  {
88
92
 
89
- player.playerId;
90
-
91
- player.playerLoc;
93
+ Debug.Log($"playerId={player.playerId}, playerLoc={player.playerLoc}");
92
94
 
93
95
  }
94
96