top of page

Obstacle Generator

The obstacle generator (Reffered to as the 'LevelGenerator' in the code), is responsible for the creating and saving of obstacles that would appear while playing the game; however, the generator itself doesn't create obstacles, but simply saves all the objects within the editor to a given obstacle ScriptableObject. 

It can do the following: 

​

  • Save an obstacle

    • Saves the positions of all saveable objects currently on screen, and within the given bounds of the obstacle grid. This information is saved to an 'Obstacle Scriptable Object'. ​

    • Also saves information of all spaces within the bounds of the grid that don't contain an object, so that a collectable may be spawned their during gameplay.

  • Load an Obstacle

    • Loads all objects from a previously saved 'Obstacle Scriptable Object', so that it may be viewed and edited.​

  • Clear an Obstacle

    • Destroys all the saveable objects currently existing in the editor scene.​

Obstacle Generator Code

SaveObstacleFunction.png
LoadObstacleFunction.png

Obstacle Generator Editor Code

GneratorEditorScript.png

Obstacle Code

ObstacleScript.png

Obstacle Info Code

ObstacleInfoScript.png

Saveable Object Code

SaveableObjectScript.png

Saveable Object Info Code

SaveableObjectInfoScript.png

Saveable Object Prefab Code

SaveableObjectPrefabScript.png
bottom of page