private void OnGUI() { //UI for selecting data folder EditorGUI.LabelField(folderLabelRect, "Select a folder where you have debug data jsons."); if (GUI.Button(buttonRect, "Load Path")) { if (debugHolders.Count > 0) { DestroyDebugObjects(); debugHolders.Clear(); } GetDebugFiles(); CreateDebugLines(); CreateCamera(); } //Dropdown menu and button if (debugHolders.Count != 0) { EditorGUI.LabelField(dropDownLabelRect, "Choose data to look at."); dropDownIndex = EditorGUI.Popup(dropDownMenuRect, dropDownIndex, dataNames.ToArray()); EditorGUI.LabelField(replayLabelRect, "Press button to replay current selected data."); if (GUI.Button(replayButtonRect, "Replay Data")) { if (replayData != null) { replayData.Clear(); StartReplay(); } } } //Timeline slider if (currentDebugHolder != null) { EditorGUI.LabelField(sliderLabelRect, "Timeline. Expand window if not showing correctly."); positionIndex = EditorGUI.IntSlider(sliderRect, positionIndex, 0, currentDebugHolder.dataHolder.positions.Count - 1); if (positionIndex >= currentDebugHolder.dataHolder.positions.Count - 1) { positionIndex = currentDebugHolder.dataHolder.positions.Count - 1; } } //Move camera and select it when changing things in the GUI if (GUI.changed) { if (debugHolders.Count > 0) { if (debugCamera != null) { if (dropDownIndex != lastDropDownIndex) { SelectData(dropDownIndex); lastDropDownIndex = dropDownIndex; } if (positionIndex != lastPositionIndex) { lastPositionIndex = positionIndex; } MoveCamera(positionIndex); Selection.activeObject = debugCamera; } } } }
private void OnDisable() { replayData.Clear(); }