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

When to use

Use Environment Change 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

Listens to EnvironmentHelper.onEnvironmentChanged. When the reported index equals environmentIndex, calls Complete(). FindFirstObjectByType<EnvironmentHelper>() is used on activate/deactivate — exactly one active helper should exist.

Code

Troubleshooting

  • Never completes — No EnvironmentHelper in scene, event never fires, or index mismatch vs environmentIndex.
  • Wrong environment completes step — Align environmentIndex with the helper’s indexing (0-based vs 1-based).
  • Multiple helpersFindFirstObjectByType binds arbitrarily; keep a single helper or replace with an injected reference in a fork.

Unity Editor

EnvironmentChangeStep with target environment references.

EnvironmentChangeStep in Unity Inspector

EnvironmentChangeStep Inspector