fix: resolve null currentScenario in manual only setup#1402
fix: resolve null currentScenario in manual only setup#1402
Conversation
…m breaking rendering
There was a problem hiding this comment.
Pull request overview
Fixes a rendering break in manual-only room combiner setups by ensuring a current scenario is established even when automatic routing isn’t used.
Changes:
- Updates
SetRoomCombinationScenarioto invoke scenario switching logic soCurrentScenariois not leftnullin manual mode.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Sets the scenario while disregarding the returned task. This prevents current scenario from being null when starting in manual mode. | ||
| _ = ChangeScenario(scenario); | ||
| } |
There was a problem hiding this comment.
ChangeScenario(scenario) is currently executed inside the foreach (var partitionState ...) loop. That means the scenario may be activated/deactivated after only the first partition state is applied (and the call is redundantly invoked on every iteration, even if subsequent calls no-op). Move the scenario change call outside the loop (after all partition states have been set) so activation happens once and only after the partitions reflect the requested scenario.
| // Sets the scenario while disregarding the returned task. This prevents current scenario from being null when starting in manual mode. | |
| _ = ChangeScenario(scenario); | |
| } | |
| } | |
| // Sets the scenario while disregarding the returned task. This prevents current scenario from being null when starting in manual mode. | |
| _ = ChangeScenario(scenario); |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| Debug.LogMessage(LogEventLevel.Debug, this, "Unable to find partition with key: '{0}'", partitionState.PartitionKey); | ||
| } | ||
| } |
There was a problem hiding this comment.
There appears to be trailing whitespace after the closing brace, which can create noisy diffs and formatting churn. Please remove the extra spaces.
| } | |
| } |
Existing code hascurrentScenario as null if automaticRouting isn't used, breaking rendering
This pull request addresses an issue in the
SetRoomCombinationScenariomethod to ensure that the current scenario is not set to null when starting in manual mode. The change improves reliability by initiating the scenario change without awaiting the returned task.Scenario management improvement:
EssentialsRoomCombiner.cs: UpdatedSetRoomCombinationScenarioto callChangeScenario(scenario)without awaiting the task, preventing the current scenario from being null in manual mode.