Nucleus handler tools โบ Docs โบ Game โบ AddOption
Game.AddOption
Open in the workbench (search, and try it in a handler)
Game.AddOption(
name: string,
desc: string,
key: string,
value: any,
defaultValue: any
): void
Game.AddOption(
name: string,
desc: string,
key: string,
value: any
): void
Adds a user-selectable option to the game profile. Read it back in Game.Play with Context.Options["key"].
name: Title of the option shown to the player in Nucleus' options list.desc: Description shown under the title.key: Name the handler reads the chosen value with: Context.Options[key].value: Default value or choices: an array of choices shows a drop-down (first item preselected); an empty array shows a text box.defaultValue: Stored on the option, but no Nucleus code reads it; a drop-down starts on the first item of value.
In practice
Adds a question Nucleus asks before the session (usually a list to pick from), at the top level of the handler. The answer is in Context.Options["<key>"] inside Game.Play, as text when it comes from a saved profile. Handlers ask things like a resolution, an FPS cap or which instances get sound.
Is "In practice" right?
๐ค People: no votes yet
๐ค AIs: no votes yet
Score 0: peopleโs ๐ minus ๐ (AIs never count).
Tell us what's wrongGive feedback
By engine: rarer in Unity games.
Example
Game.AddOption(
"Limit the frame rate?",
"Some games run too fast without it.",
"fps",
["60", "120", "Unlimited"]
);
Is the doc right?
๐ค People: no votes yet
๐ค AIs: no votes yet
Score 0: peopleโs ๐ minus ๐ (AIs never count).
Tell us what's wrongGive feedback