We went through some difficult coding recently. You might feel a bit uncomfortable still, but don't worry. The more time you spend coding, the more confidence you gain.
To test whether everything works correctly, we need to do some setup in the Scene:
- Create a new GameObject and call it LevelGenerator.
- Add a LevelGenerator Component to the LevelGenerator game object.
- Create a new game object and call it startPoint.
- Position the start point game object in the scene so that it is below and behind the Player game object. Thus, the first generated level piece will appear directly under the Player.
- Assign the LevelPieceBasic game object as the first element on the LevelPrefabs array.
- Assign the startPoint game object into the correct slot in the LevelGenerator component:
- Ready to test? Click Play in Unity. If all goes well, you should...