Static Access

MemberTypeDescription
currentInstructionSheetSingleton set in Awake(). Use this to interact with the sheet from any script.
containerRectRectTransformStatic reference to the sheet's scroll container. Used by layout widgets to compute drop positions.

Inspector Fields

FieldTypeDescription
containerTransformParent transform under which all InstructionLayout instances are spawned.
insertIndicatorRectTransformVisual line that previews the drop position while an instruction is being dragged over the sheet.
pointerRectTransformExecution cursor that lerps to the currently executing instruction during a run.
pointerMoveSpeedfloatLerp speed of the execution cursor. Default: 4.
playButtonButtonStarts execution. Disabled while running.
stopButtonButtonStops execution. Enabled while running.
clearButtonButtonDestroys all instructions on the sheet.
speedDownButtonSets Time.timeScale to 1 (normal speed).
speedUpButtonSets Time.timeScale to 2 (fast-forward).
undoButtonButtonReverts the last sheet mutation.
redoButtonButtonRe-applies the last undone mutation.
audioSourceAudioSourceUsed to play sheet SFX.
indicatorMoveSoundAudioClipPlayed when the insert indicator moves to a new position.
addInstructionSoundAudioClipPlayed when an instruction is added to the sheet.
removeInstructionSoundAudioClipPlayed when an instruction is removed.

Properties

PropertyTypeDescription
LayoutsIReadOnlyList<InstructionLayout>All InstructionLayout widgets currently on the sheet, in order.
lastSiblingInstructionLayoutThe last layout in the list, or null if the sheet is empty.
instructionDatasSerializedInstruction[]A snapshot of the current sheet state as serializable structs. Used internally by the undo system and by LevelManager for save/load.

Methods

MethodDescription
Insert(int index, Action action)Creates a new instruction from action at index. Saves a snapshot for undo. Called by layout widgets when an instruction is dropped above or below an existing one.
RemoveInstruction(InstructionLayout layout)Removes the given layout and its instruction from the sheet. Saves a snapshot for undo and plays the remove sound.
ClearSheet()Destroys all layouts and instructions. Saves a snapshot so the clear can be undone.
SpeedUp()Sets Time.timeScale to 2.
SpeedDown()Sets Time.timeScale to 1.
Undo()Pops the undo stack and restores the previous snapshot. Pushes the current state to the redo stack. Also triggered by Ctrl+Z.
Redo()Pops the redo stack and restores that snapshot. Pushes the current state to the undo stack. Also triggered by Ctrl+Y.
Load(LevelInfo level)Populates the sheet from saved instruction data stored on level. Does not save a snapshot or play sounds.
PlayAddInstructionSound()Plays the addInstructionSound clip. Called by sequence and modifier layouts when a child instruction is added.
UpdateLayoutRect(InstructionLayout layout)Sets the execution cursor's target to the given layout. Called by the runner as it advances through instructions.
SetInsertIndicatorInactive()Hides the insert indicator. Called when a drag ends without a valid drop.

Undo / Redo System

Every mutation (add, remove, insert, clear) automatically calls SaveSnapshot() before the change, which pushes a SerializedInstruction[] copy of the sheet onto the undo stack. The stack is capped at 20 entries. Any mutation after an undo clears the redo stack.

Restoring a snapshot destroys all current layouts and rebuilds them from the saved data using Action.Load() — this path does not trigger sounds or additional snapshots.