Newer
Older
HoloAnatomy / Assets / HoloToolkit-Examples / Input / Scripts / TestOverrideFocusedObject.cs
SURFACEBOOK2\jackwynne on 25 May 2018 1000 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;

namespace HoloToolkit.Unity.InputModule.Tests
{
    public class TestOverrideFocusedObject : MonoBehaviour, IInputClickHandler
    {
        private InputManager inputManager;
        private TextMesh textMesh;

        private void Start()
        {
            inputManager = InputManager.Instance;

            if (inputManager != null)
            {
                inputManager.OverrideFocusedObject = gameObject;
            }

            textMesh = FindObjectOfType<TextMesh>();
        }

        public void OnInputClicked(InputClickedEventData eventData)
        {
            if (textMesh != null && inputManager != null)
            {
                textMesh.text = "Air tap worked and OverrideFocusedObject is null.";
                inputManager.OverrideFocusedObject = null;
            }
        }
    }
}