Next, we will add a script to the cherry prefab to support the creation and release of the cherry with respect to the Cucumber Man's hand.
- In the Project panel, select Assets | Cherry | Cherry.Prefab
- In the Inspector panel, click the Add Component button
- Select New Script and name the script CherryControl
- Click the Create and Add button
- In the Project panel, drag the new script into the Assets | Custom Scripts folder
- Edit the script so that it matches what is provided in the following code block
The first part of the script consists of the namespace import statements and the class declaration:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class CherryControl : MonoBehaviour ...