• Home
  • Documentation
  • Guides
  • FAQ
  • Get Essential UI Pack
Search Results for

    Show / Hide Table of Contents
    • LlamaSoftware.UI
      • ButtonClickSoundPlayer
      • Draggable
      • EUIPButton
      • EUIPButton.ButtonLabelStyle
      • EUIPSlider
      • EUIPSlider.DisplayFormat
      • InputFieldSliderValueDisplay
      • MenuController
      • MultiValueToggle
      • MultiValueToggleArrow
      • MultiValueToggleArrow.OnPointerUpCallback
      • Page
      • Popover
      • ProgressBar
      • ScrollViewZoomFixer
      • SliderValueDisplay
      • SliderValueSetter
      • Spinner
      • UIAnimationConstants
      • UIAnimationConstants.Direction
      • UIAnimationConstants.EntryMode
    • LlamaSoftware.UI.Tabs
      • TabbedPanel
      • TabbedPanel.ChangeTabEvent
      • TabbedPanelContent
      • TabbedPanelHeader
    • LlamaSoftware.UI.Utility
      • CornersUIGradient
      • RotatableLinearUIGradient
      • SimpleProgressBar
      • TextUpdatingProgressBar
      • UIGradientUtils
      • UIGradientUtils.Matrix2x3

    Class ButtonClickSoundPlayer

    Finds all UnityEngine.UI.Button, UnityEngine.EventSystems.EventTrigger, and UnityEngine.UI.Toggle components and adds a UnityEngine.UI.Button.onClick / UnityEngine.EventSystems.EventTriggerType.PointerUp / UnityEngine.UI.Toggle.onValueChanged event that plays the provided UnityEngine.AudioClip.

    The purpose of that is to batch all LlamaSoftware.UI.ButtonClickSoundPlayer.AudioSources for each of these components into a single LlamaSoftware.UI.ButtonClickSoundPlayer.AudioSource. Each AudioSource in the scene has some CPU overhead. Batching controls that will play separately allows a great reduction of AudioSources in the scene, and thsu frees many CPU cycles. This comes at the downside of each control should utilize the same UnityEngine.AudioClip.

    If you would like different sounds for a UnityEngine.UI.Button click versus a UnityEngine.UI.Toggle change, you can attach 2 of these components to the root UnityEngine.Canvas and configure one to LlamaSoftware.UI.ButtonClickSoundPlayer.IncludeButtons = true and one to LlamaSoftware.UI.ButtonClickSoundPlayer.IncludeToggles = true.

    Inheritance
    System.Object
    UnityEngine.Object
    UnityEngine.Component
    UnityEngine.Behaviour
    UnityEngine.MonoBehaviour
    ButtonClickSoundPlayer
    Namespace: LlamaSoftware.UI
    Assembly: LlamaSoftware.UI.dll
    Syntax
    [RequireComponent(typeof(AudioSource))]
    public class ButtonClickSoundPlayer : MonoBehaviour
    In This Article
    Back to top Generated by DocFX