using UnityEngine.Events;
#if UIELEMENTS_MODULE_AVAILABLE
using UnityEngine.UIElements;
#endif
namespace UnityEngine.XR.Interaction.Toolkit.Samples.WorldSpaceUI
{
///
/// Sample class that demonstrates how to bind to a UI Toolkit button click event.
///
public class ButtonEventSample : MonoBehaviour
{
[SerializeField]
UnityEvent m_OnButtonClicked = new UnityEvent();
///
/// Event to be invoked when the UI Toolkit button is clicked.
///
public UnityEvent onButtonClicked
{
get => m_OnButtonClicked;
set => m_OnButtonClicked = value;
}
const string k_LabelName = "DebugLabel";
#if UIELEMENTS_MODULE_AVAILABLE
Button m_Button;
Label m_Label;
#endif
void Start()
{
#if UIELEMENTS_MODULE_AVAILABLE
var uiToolkitDoc = GetComponent();
if(uiToolkitDoc != null)
{
var root = uiToolkitDoc.rootVisualElement;
m_Button = root.Q