Definition
ScaleGUIButton(string GUIName, string buttonName, double scaleValue)
Description
This function sets the scale of the button buttonName that belongs to the GUI GUIName. In this case, the length and width of the button buttonName are multiplied by the scaleValue. A value of 1.0 for scaleValue will be equivalent to the initial size of the button.
Parameters
GUIName
Specifies the GUI name. You can also use the name “this” for this parameter. In this case, the name “this” refers to the GUI to which the button buttonName belongs.
buttonName
Specifies the button name that belongs to the GUI GUIName.
scaleValue
Specifies the scale of the button buttonName that belongs to the GUI GUIName. This value must be equal to or greater than 1.0.
Example 1
function OnTriggerEnter(otherActorName) ScaleGUIButton("gui_SampleGUI17_MainMenu", "PlayGame", 2.0) end function OnTriggerStay(otherActorName) end function OnTriggerExit(otherActorName) end
Assume that the above script is attached to a trigger named “trigger1”. Whenever the main character or a prefab instance that has dynamic physics is entered into this trigger, ScaleGUIButton function sets the scale of the button “PlayGame” that belongs to GUI “gui_SampleGUI17_MainMenu” to 2.0. In this case, the length and width of the button “PlayGame” are multiplied by 2.0.
Example 2
--Name of script is ScaleGUIButton2.lua function OnSelectMouseLButtonDown() ScaleGUIButton("this", "PlayGame", 2.0) end function OnSelectMouseRButtonDown() end function OnSelectMouseEnter() end
Assume that the above script named ScaleGUIButton2.lua is attached to a button named “PlayGame” that belongs to the GUI “gui_1”. In this case, “this” string in the ScaleGUIButton function refers to the name “gui_1”. Whenever the user left clicks the “PlayGame” button, the ScaleGUIButton function doubles the size of the “PlayGame” button belonging to GUI “gui_1”.