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 ...

Get Unity Android Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.