Making it endless

Now that we have a foundation, let's now make it so that we can continue running instead of stopping after a short time:

  1. To start off with, we have our prefab, so we can delete the original Basic Tile in the Hierarchy window by selecting it and then pressing the Delete key.
  1. We need to have a place to create all of these tiles and potentially manage information for the game, such as the player's score. In Unity, this is typically referred to as a GameController. From the Project window, go to the Scripts folder and create a new C# script called GameController.
  2. Open the script in your IDE, and use the following code:
using UnityEngine;/// <summary> /// Controls the main gameplay /// </summary> public class GameController ...

Get Unity 2017 Mobile Game Development 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.