Generated laboratory - GameLabGraz/Maroon GitHub Wiki


Creating a new LaboratoryBlock

Creating a prefab variant of the prefab Assets/0Refactored/scenes/laboratory/prefabs/LaboratoryBlock/LaboratoryBlock is the first step of building a new LaboratoryBlock. A LaboratoryBlock is a preview of an experiment that can be placed inside any auto-generated laboratory. The LaboratoryBlock of an experiment has to be placed at experiments/<ExperimentName>/Resources/<ExperimentName>.laboratoryblock.

The experiment templates folder Assets/0Refactored/scenes/templates/ already contains a template for the LaboratoryBlock. If the experiment folder is a copy of the templates folder, all necessary files should already be created and just need to be renamed.

The prefab contains two game objects:

EditorOnly

The contents of this game object help positioning the preview. A reference indicates how the player will be able to walk along the preview. A template consisting of floor and wall indicates how much space is available for placing items. Note that there might appear windows on the wall that are not placed in this preview. All of those elements will not be visible in the generated laboratory.

ExperimentPreview

All elements of the preview should be children of this game object. An entry point to the experiment can be provided by placing the prefab Assets/0Refactored/scenes/laboratory/prefabs/InfoSign/InfoSign and linking the corresponding scenes in the attached script.


Adding a LaboratoryBlock to a laboratory

The SegmentBuilder of the laboratory prefab arranges the LaboratoryBlocks automatically. The blocks that are displayed are selected based on the scene categories in the SceneManager.