public virtual HandModelRecording EndRecording() { HandModelRecording finishedRecording = _currentRecording; _currentRecording = null; switch (_saveType) { case SaveType.None: break; case SaveType.UnityAsset: #if UNITY_EDITOR //Directory.CreateDirectory(_unityAssetSavePath + ".dummy"); _unityAssetSavePath = IsLeft ? _unityAssetSavePathLeft : _unityAssetSavePathRight; string path = AssetDatabase.GenerateUniqueAssetPath(_unityAssetSavePath + ".asset"); AssetDatabase.CreateAsset(finishedRecording, path); AssetDatabase.SaveAssets(); //string json = JsonUtility.ToJson(finishedRecording);File.WriteAllText(Application.dataPath + "/HandData.json", json); break; #else throw new Exception("Cannot save unity assets outside of Unity Editor"); #endif default: break; } Debug.Log("Hand Recording Finished"); return(finishedRecording); }
public virtual void StartRecording() { _beginTime = Time.time; _currentRecording = ScriptableObject.CreateInstance <HandModelRecording>(); Debug.Log("Recording started"); }