private void SaveRecordingToFile(AnimationRecorder animRec)
        {
            AnimRecordingFile file = new AnimRecordingFile(animRec.gameObject.name, animRec.RecordingDuration, animRec.Recordings);
            string            json = JsonConvert.SerializeObject(file, Formatting.Indented);
            string            path = EditorUtility.SaveFilePanelInProject("Save animation to json file",
                                                                          ToCamelCase(file.GameObjectName) + "-animRecording", "json",
                                                                          "Please select the location for the animation file.");

            File.WriteAllText(path, json);
        }
Ejemplo n.º 2
0
        private void LoadAnimation(AnimationPlayer animPlayer, string filePath)
        {
            AnimRecordingFile file = JsonConvert.DeserializeObject <AnimRecordingFile>(File.ReadAllText(filePath));

            animPlayer.SetAnimation(file.AnimationDuration, file.Recordings);
        }