Event - OuterRimStudios/Utilities GitHub Wiki
AnalyticsUtilities.Event
public static void Event<T>(string eventName, List<T> data)
eventName The name of the event which will be used to create the filename.
data The data that you want written to the csv file.
Writes data to a csv file.
Example Using an Anonymous Type
using System.Collections.Generic;
using OuterRimStudios.Utilities;
public class ExampleClass : MonoBehaviour
{
void Start()
{
//Create a list that holds the data you want written to the csv file. This can contain as many elements as you want.
var data = new List<object> { new { IntTest = 36, FloatTest = 3.615f, StringTest = "Sam"} };
//This will create or append the data to a file.
AnalyticsUtilities.Event("Test", data);
}
}
Note: With this use case you need to make a class with properties for each data point you want to track. The property names become the headers for the csv file.
using System.Collections.Generic;
using OuterRimStudios.Utilities;
public class ExampleClass : MonoBehaviour
{
void Start()
{
//Create a list that holds the data you want written to the csv file. This can contain as many elements as you want.
List<TestData> data = new List<TestData> { new TestData{ IntTest = 36, FloatTest = 3.615f, StringTest = "Sam"} };
//This will create or append the data to a file.
AnalyticsUtilities.Event("Test", data);
}
}
//This class is a template for how the data will be organized in the csv file. The property names become the headers for the csv file
public class TestData
{
public int IntTest { get; set; }
public float FloatTest { get; set; }
public string StringTest { get; set; }
}