Time for action – controlling the indicator

We now need to create a script that will control the indicator slices. This will include creating new slices as they are needed. Also, the GameObject it is attached to will act as a center point for the indicator slices, that we just created, to rotate around.

  1. Create a new script and name it IndicatorControl.
  2. We start this script off with a pair of variables. The first will hold a reference to the prefab that was just created. This will allow us to spawn instances of it whenever we desire. The second is a static variable, meaning it can be easily accessed without a reference to the component that exists in the scene. It will be filled when the game starts with a reference to the instance of this script ...

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.