How to alter peramiters of Ui elements in lua script. Example setting a button to load a level in code.
Hello @steveH,
Looking at your other question, you have already learned how to access UI components and tell them to do stuff. To answer your specific example (loading a level with button click), have code similar to the following in the OnButtonClick function:
function someClass:OnButtonClick()
ConsoleRequestBus.Broadcast.ExecuteConsoleCommand("map map_name_here")
end
The ConsoleRequestBus gives access to the console commands, and also works in a release build.
Note: Loading a level dynamically does not currently work in the editor (i.e. to test this, access the launcher for your game in the dev/Buildvc<120 or 140> folder). On a Windows PC, you will need to make a shortcut with +map map_name_here at the end of the target (e.g. C:\Path\To\dev\Buildvc140\gamelauncher.exe +map mainlevel)