Now that we have a simple obstacle, we can now spawn a number of them through code using this object as a reference. To make this easier, let's make the obstacle a prefab:
Prefabsfolder. Then, from the Hierarchy tab, drag and drop the
Obstacleobject into the Project tab's
Prefabsfolder. The obstacle object should turn the object.
Obstacleobjects from the Hierarchy tab and delete it because we won't need it anymore.
GameControllerscript and add the following variables:
[Header("Obstacle Information")] [Tooltip("The obstacle that we will spawn")] public GameObject obstacleReference; ...