SetGUIPosition

Definition

SetGUIPosition(string GUIName, int x, int y)

Description

This function specifies the X and Y of the GUI GUIName as a percentage of the screen width and height. You can view and copy the name of the GUIs in the Script Utility section (Tools > Script Editor > Tools > Script Utility) or the Prefabs and GUIs section of the current VScene.

Parameters

GUIName
Specifies the name of the GUI.

x, y
specify the X and Y of the GUIName as a percentage of the screen width and height. Each of these two values must be in the range [-100, 100]. -100 means (-screen width) or (-screen height) and 100 means (screen width) or (screen height). It should be noted that the width of the GUI ranges from (-screen width) to (screen width) and the height of the GUI ranges from (-screen height) to (screen height).

Example

function Init()
    SetGUIPosition("gui_SampleGUI17_MainMenu", -5, 10)
end

function Update()

end
In this example, SetGUIPosition function sets the X and Y of the GUI named “gui_SampleGUI17_MainMenu” to -5 and 10 percents of the screen width and height, respectively. Assuming that the width and height of the screen are equal to 1024 and 768 respectively, these numbers will be equal to (-5 * 1024 / 100 = -51.2) and (10 * 768 / 100 = 76.8) respectively, , in screen coordinates.
adminSetGUIPosition