Dictionary Value to Disable Options
Scene Button Disabled based on Dictionary Value
In the code below, located in a State file associated with a Scene, there's logic that checks the GameData Dictionary to see if the key-value pair: "choice1": "heart" exists in the dictionary. If it exists, then ButtonOption1 is disabled. This logic is executed as soon as the Corresponding scene is loaded, so the button is disabled before the Scene is displayed. This is a toy example, but this is a reasonable place for this logic to be located. It illustrates the general idea of checking dictionary values to determine options available as a scene is loaded. A Dictionary< string, string > provides flexibility to include any user choices that can be used to constrain the user's options.
Scene2State.cs Logic to Disable Button depending on Dictionary values
The video below shows that selecting the heart option eliminates the option to return to the BeginScene from Scene 2. Logic could be added to disable the Choice panel once the heart button has been selected, otherwise, the dictionary updates the "choice1" value each time the player selects a button.
Last updated