Jsonデータを作成する

Jsonデータをむりくり作成

using UnityEngine;
using System.Collections;

public class jsontest : MonoBehaviour {

	// Use this for initialization
	public string playerName;
	public int lives;
	public float health;

	public string SaveToString(){
	playerName = "cat";
		lives = 10;
		health = 9.9f;
		return JsonUtility.ToJson(this);
		//Debug.Log (myjson);
	}

	void Start(){

		var myjsondata = SaveToString ();
		Debug.Log (myjsondata);
	}

}