Skip to content

Toggle User Interface Element Visibility

Toggle User Interface Element Visibility

Changes whether a specific user interface element is visible or hidden.

Properties

System

Name Explanation Type
User Interface Element The unique ID of the user interface element to change the visibility of. Variable or Value
Visibility Whether the user interface element should be visible. Switch or Value

Examples

Show a User Interface Element

This makes the user interface element whose unique ID is stored in Global Variable 0 visible.

toggle_ui_element_visibility($gv[0], true);
{"Data":{"ID":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"IsVisible":{"IsGlobalSwitch":false,"IsLocalSwitch":false,"IsValue":true,"Value":true,"SwitchIndex":0,"Metadata":null},"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.ToggleUserInterfaceElementVisibilityCommand"}

Hide a User Interface Element

This hides the user interface element whose unique ID is stored in Global Variable 0.

toggle_ui_element_visibility($gv[0], false);
{"Data":{"ID":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"IsVisible":{"IsGlobalSwitch":false,"IsLocalSwitch":false,"IsValue":true,"Value":false,"SwitchIndex":0,"Metadata":null},"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.ToggleUserInterfaceElementVisibilityCommand"}

Toggle Visibility Based on a Global Switch

This sets the visibility of the element to match the value of Global Switch 0.

toggle_ui_element_visibility($gv[0], $gs[0]);
{"Data":{"ID":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"IsVisible":{"IsGlobalSwitch":true,"IsLocalSwitch":false,"IsValue":false,"Value":false,"SwitchIndex":0,"Metadata":null},"Metadata":null},"TypeName":"MAR.Game.Shared.Models.Scripts.Commands.UserInterface.ToggleUserInterfaceElementVisibilityCommand"}