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

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.
using MolcaSDK.VR.Scenario;

public class PinLesson : UnityEngine.MonoBehaviour
{
    public CodeInputStep step;

    private void OnEnable()
    {
        step.SetExpectedCode("1234");
        // step.ForceComplete(); // escape hatch
    }
}

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