File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 55using System . Collections . Generic ;
66using UnityEngine ;
77using UnityEditor ;
8+ using Unity . Mathematics ;
89
910[ System . Serializable ]
1011public class CSVWriter
@@ -18,6 +19,7 @@ public class CSVWriter
1819 [ SerializeField , ReadOnly ] private string filePath ;
1920 private StreamWriter eventWriter ;
2021 private List < string > payload = new List < string > ( ) ;
22+ private bool is_active = false ;
2123
2224 public bool Initialize ( ) {
2325 string dname = Application . persistentDataPath ;
@@ -41,6 +43,7 @@ public bool Initialize() {
4143 eventWriter . WriteLine ( String . Join ( ',' , columns ) ) ;
4244 }
4345
46+ is_active = true ;
4447 return true ;
4548 }
4649
@@ -84,6 +87,11 @@ public void AddPayload(Vector3 to_add) {
8487 payload . Add ( to_add . y . ToString ( ) ) ;
8588 payload . Add ( to_add . z . ToString ( ) ) ;
8689 }
90+ public void AddPayload ( float3 to_add ) {
91+ payload . Add ( to_add [ 0 ] . ToString ( ) ) ;
92+ payload . Add ( to_add [ 1 ] . ToString ( ) ) ;
93+ payload . Add ( to_add [ 2 ] . ToString ( ) ) ;
94+ }
8795 public void AddPayload ( Quaternion to_add ) {
8896 AddPayload ( to_add . eulerAngles ) ;
8997 }
@@ -94,7 +102,10 @@ public static long GetUnixTime() {
94102 }
95103
96104 public void Disable ( ) {
97- eventWriter . Flush ( ) ;
98- eventWriter . Close ( ) ;
105+ if ( is_active ) {
106+ eventWriter . Flush ( ) ;
107+ eventWriter . Close ( ) ;
108+ }
109+ is_active = false ;
99110 }
100111}
You can’t perform that action at this time.
0 commit comments