Add an audio button to turn on and off the sound in your game. Just drag it from the Asset panel to the UI Editor and define the audio button attributes as described below. See also Adding Music and Sound Effects.
Name and Transform Attributes
|Name||Enter a custom name for the button, if needed. It will be displayed in the Outliner.
Don’t leave this field blank, as you won’t be able to tell what button it is if you hide it.
|Position||Enter the appropriate values for each axis to specify a precise position for the button on the screen.
You can also drag the button to the desired location directly in the UI Editor.
|Rotation||Enter a degree value to specify the rotation angle of the button.|
|Scale||Enter a value for each axis to make the button as proportionally large, or wide or narrow as needed.
You can also select the button in the UI Editor and drag its corner handles to resize it as needed.
|Opacity||Enter a value from 0 to 1 to specify the transparency of the button. For example, if you enter .5, the image will be semi-transparent.|
|Sound is ON image||Drag a PNG file for the button when the sound is on.|
|Sound is OFF Image||Drag a PNG file for the button when the sound is off.|
|Autohide||If you want the button to appear momentarily and then fade away, specify the number of seconds for the button to be displayed for before disappearing.
To keep the button displayed on the screen, enter 0.
|Stick to Edge||Select this checkbox to keep the relative size and position of the button when scaling the screen for different sizes.|
|Additive Blending||Select to add a glow effect overlay to any graphics or 3D objects underneath the button.|
Function and Properties Attributes
|Function||Select an option where your sound will take effect:
|Block Touch Through||If this button happens to be stacked on top of another button, and you don’t want the player to be able to tap the button underneath and trigger its action, select this check box.|
|Keyboard Key||Typically applies to Windows exports. Type a key name that will activate the button when the user presses the specified key. In some scenarios, you may also associate it the Back button on the Android devices.|