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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.