It's great to have a way to do the events through the editor, but for those who are more comfortable working with code, it's also just as easy to do so.
One additional thing that we may want to track is how far players get before they lose. Let's take a look at how to do that now:
- First, we will need to open up the ObstacleBehaviour script to modify what happens when the game ends.
- To utilize Unity Analytics at the top of the file, we will add the following using declarations:
using UnityEngine.Analytics; // Analyticsusing System.Collections.Generic; // Dictionary
The top option is obvious, but we are also adding System.Collections.Generic in order to get access to the Dictionary class, which we will use ...