Newer
Older
HoloAnatomy / Assets / HoloToolkit-Examples / Input / Scripts / OnFocusEvent.cs
SURFACEBOOK2\jackwynne on 25 May 2018 736 bytes v1
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using UnityEngine;
using UnityEngine.Events;

namespace HoloToolkit.Unity.InputModule.Tests
{
    public class OnFocusEvent : MonoBehaviour, IFocusable
    {
        public UnityEvent FocusEnterEvent;
        public UnityEvent FocusLostEvent;

        public void OnFocusEnter()
        {
            if (FocusEnterEvent != null)
            {
                FocusEnterEvent.Invoke();
            }
        }

        public void OnFocusExit()
        {
            if (FocusLostEvent != null)
            {
                FocusLostEvent.Invoke();
            }
        }
    }
}