Building the TestingInput

We are going to use a pattern called a Singleton in order to implement a class that we can access from anywhere in our code, much like the input class from Unity that is currently used. Unity has the benefit of making the input completely static, but for our purposes, we will use the well-defined scripting version. Open the editor and follow the next exercise to build the TestingInput script and object:

  1. Select the HoDLG | Scripts folder and open the Create menu.
  2. From the Create menu, select C# Script. Name the new script Singleton. This script is the standard pattern script from http://wiki.unity3d.com/index.php/Singleton; the script is shown as follows:
using UnityEngine;namespace Packt.HoDLG{  /// <summary> /// ...

Get Hands-On Deep Learning for Games 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.