VisualState potentially off-by-one (or just wrong) on launch
Posted: 21 Aug 2023, 17:15
I have this situation specifically with my child of the main view. There's a 50% chance on launch that we I `GoToStateAction` to `first_state` I actually go to that state or go to the state after it (say `second_state`). This is fixed by restarting Unreal without changing aynthing for me, I haven't tried what happens in the shipping build yet.
The code would look something like
The widgets[global_widget] is an implementation detail of how I'm communicating wtih NoesisGUI, but I wanted to include that in case binding to dict inside of a dict would have some relevance. BTW, this exact model works for virtually everything else, it's only the child of the main view that has this problem.
The code would look something like
Code: Select all
<Grid x:Name="RootGrid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="ui_mode_group">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.1"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="normal"/>
<VisualState x:Name="none"/>
<VisualState x:Name="minigame">
<Storyboard>
...
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="combat_state_group">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0"/>
</VisualStateGroup.Transitions>
<VisualState x:Name="combat_inactive">
<Storyboard>
...
</Storyboard>
</VisualState>
<VisualState x:Name="combat_active">
<Storyboard>
...
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<b:Interaction.Triggers>
<b:PropertyChangedTrigger Binding="{Binding widgets[global_widget].strings[mode]}">
<b:GoToStateAction StateName="{Binding widgets[global_widget].strings[mode]}" />
</b:PropertyChangedTrigger>
<b:PropertyChangedTrigger Binding="{Binding widgets[global_widget].strings[combat_state]}">
<b:GoToStateAction StateName="{Binding widgets[global_widget].strings[combat_state]}" />
</b:PropertyChangedTrigger>
</b:Interaction.Triggers>