O'Reilly logo

Unity Android Game Development by Example Beginner's Guide by Thomas Finnegan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – tracking scripts

We will be creating this script in the Space Fighter game:

  1. First, we will need a special class that will keep track of our performance statistics. Create a new script and name it TrackerStat.
  2. To begin this script, we first need to change the class definition line. We do not want or need to extend the MonoBehaviour class. So, find the following line of code:
    public class TrackerStat : MonoBehaviour {

    And, change it to the following:

    public class TrackerStat {
  3. This script starts with four variables. The first will be used as an ID, allowing us to track multiple scripts at once by supplying different key values. The second will keep track of the average amount of time that the tracked bits of code are taking. The third ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required