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

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

// Raise from your environment switcher:
// environmentHelper.onEnvironmentChanged.Invoke(newIndex);

using MolcaSDK.VR.Scenario;

// Serialized environmentIndex on EnvironmentChangeStep must match emitted index.

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