Skip to main content
File: Assets/_MolcaSDK/_VR/Scripts/Scenario/Steps/CodeInputStep.cs
Base: Step

When to use

Use Code Input Step when a VR training scenario needs this specific interaction as a step in a sequence. Configure entirely in the Inspector — no code required.

Role

Completes when the trainee enters the expected code sequence (see Inspector for length, validation, and UI hooks). Often pairs with shared Modals / keyboard widgets.

Code

CodeInputPanel.onCodeValidatedOnCodeValidatedValidateCode; if valid, Complete(). Validation uses expectedCode only when useStepExpectedCode (panel-driven otherwise; onCodeValidated implies panel accepted input). autoShowPanel, showInVR + offset, hideOnComplete, resetOnActivate control UI.

Troubleshooting

  • No CodeInputPanel — Assign or place CodeInputPanel on/under the same GameObject; auto-find runs in Initialize.
  • Always invalid — If relying on step code, enable useStepExpectedCode and set expectedCode (or SetExpectedCode). Otherwise configure the panel’s own expected code so onCodeValidated only fires when correct.
  • Panel not visible in HMD — Enable showInVR, adjust vrPositionOffset, ensure Camera.main exists for placement.

Unity Editor

CodeInputStep + in-scene code panel.

CodeInputStep in Unity Inspector

CodeInputStep Inspector