Sometimes, we want to save data from our game into our local computer, whether for debugging, recording game testing experiments, and so on. The comma-separated variable (CSV) text file format is a good format to save data in since it is easily read into rows and columns by almost all spreadsheet applications.
In this recipe, we'll write a script that offers a method that can be called from anywhere in our game, from any scene, that will add a row of text to a log file. The following is an example of the saved data when viewed in Microsoft Excel:
![](https://static.packt-cdn.com/products/9781839217616/graphics/assets/9505dc4e-6150-4b34-9477-592ea3d77f25.png)
Figure 13.14 – Log data viewed in a spreadsheet application