Getting Google Sheet Data Updates In Unity

Separating data from Unity code is one of the main ways to keep your project maintainable and resistant to change. Anyone who has experience in game development knows how quick iteration in a constantly changing universe is a necessary part of the process.

(Yes, you are the cat.)

In case your game has a substantial narrative part, facilitating writer/developer interaction is also very important; I was reminded how common is this need by a recent interview of Leigh Alexander The Most Important Part Of Writing A Video Game Is The Tools, on her writing experience for Reigns: Her Majesty.

Writing for games has specific needs and contexts (see a detailed post of mine Videogame Dialogues: Writing Tools And Design Ideas), and so its important for the writer and the developers to quickly see how the text appears in the context of gameplay.

Supposing your writer is updating a Google sheet, I provide you with a very simple way to automatically get an updated textual asset at each Unity run, so making it easy to check how it feels in game.

The solution is simple as Google lets you download any shared doc in CSV format by just requesting the correct URL; you can also specify a target sheet in a multi-sheet document. What is a little bit tricky is that whenever your writer is using newlines, commas or quotation marks, this may break the CSV format.

What is cool of the solution is that it creates a textual asset of the downloaded content, so that say as long as you are running in Unity’s editor, you download the updates, but as soon as you build, the app will use the asset.

You find a complete solution as a Gist on Github :-)

Follow me on Twitter where I post about game design, game development, Unity3d, applied / serious games.

Social Share Toolbar

Leave a Reply to Pietro Polsinelli Cancel reply

*