In this section, we'll see how to script our project:
- We will first make sure to utilize Unity Engine, as we need access to MonoBehaviour:
using UnityEngine;
- Our public class will be called TargetLocationController, which is the same name as the script file we named in the Unity Editor. We will also inherit from MonoBehaviour:
public class TargetLocationController : MonoBehaviour{
- We will create a public GameObject called targetObject; this is so that we can drag and drop our prefab onto this object to set a reference to it:
private GameObject targetObject;
- We will create a Start() method at this point. We want to find the object in the project with the tag of targetLocation, as we will be creating it upon a ...