mixedreality/com.microsoft.mixedreality..../SDK/Features/UX/Scripts/PressableButtons/SubmitEventRouter.cs

22 lines
774 B
C#

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using UnityEngine;
using UnityEngine.EventSystems;
namespace Microsoft.MixedReality.Toolkit
{
/// <summary>
/// This is a helper class to allow you to call OnSubmit() on a UnityEngine.UI.Button or other control derived from UnityEngine.EventSystems.ISubmitHandler on this gameObject.
/// It exposes a public function that can be bound in the Editor to a Unity Event.
/// </summary>
[AddComponentMenu("Scripts/MRTK/SDK/SubmitEventRouter")]
public class SubmitEventRouter : MonoBehaviour
{
public void Submit()
{
ExecuteEvents.Execute(this.gameObject, new BaseEventData(EventSystem.current), ExecuteEvents.submitHandler);
}
}
}