The script for this game is very simple and basic in nature. Without a scoring mechanism or need for a state machine, the script is just a shell to house the reset function.
While the game is running, the script listens for the Touch Controller's B or Y buttons. If either of these are pushed, the script destroys the balls and bottles from the scene and replaces them with new prefabs. It is a very fast solution which is easy to follow:
- Open the BottleGameController script and edit it to match the following. The script starts by setting variables for the prefabs and the transforms:
using System.Collections;using System.Collections.Generic;using UnityEngine; public class BottleGameController : MonoBehaviour ...