public static void SaveGestures(string filePath = "Assets/MhGesture/Data/Gestures.json") { MhGestureList list = new MhGestureList(); list.gestures = gestures; string jsonString = JsonUtility.ToJson(list, true); File.WriteAllText(filePath, jsonString); }
public static void LoadGestures(string filePath = "Assets/MhGesture/Data/Gestures.json") { /*string fullPath = Application.dataPath; * //string fullPath; #if UNITY_EDITOR * fullPath += "/MhGesture/Data/Gestures.json"; #else * fullPath += "/Resources/Gestures.json"; #endif * if (!File.Exists(fullPath)) * { * Debug.Log(string.Format("File in path: {0} was not found", fullPath)); * return; * * }*/ //string jsonString = File.ReadAllText(fullPath); TextAsset gestureFile = Resources.Load <TextAsset>("Gestures"); string jsonString = gestureFile.text; MhGestureList list = JsonUtility.FromJson <MhGestureList>(jsonString); gestures = list.gestures; analyzer.PointPatternSet.AddRange(list.gestures); }