static void OnSaveRecording() { if (!EditorApplication.isPlayingOrWillChangePlaymode) { return; } GameDebuggerSerializer.DumpToFile(); }
static void OnLoadSavedRecording() { if (!EditorApplication.isPlayingOrWillChangePlaymode) { return; } bool success = GameDebuggerSerializer.LoadDataFromFile(); if (!success) { Debug.LogError("Cant load replay data from file"); } }
private static void RecordData(Type t, UnityEngine.Object o) { List <Type> list; if (m_TypeToRecordable.TryGetValue(t, out list)) { foreach (var type in list) { var recordable = (Recordable)Activator.CreateInstance(type); Recordable previous = null; if (!m_sync) { m_sessionRecords.TryGetValue(o.GetInstanceID(), out previous); } if (recordable.OnRecord(previous, o)) { var component = o as Component; var gameObject = component == null ? null : component.gameObject; m_frameRecords[m_frame].records.Add(new RecordableInfo(o.GetInstanceID(), GameDebuggerSerializer.GetID(o), recordable)); m_sessionRecords[o.GetInstanceID()] = recordable; } } } }