how to make a gaze work with a button?
i used gvr sdk 1.0.3 and unity 5 .i have created an app if the user gazes at an object it goes to next scene.how to make it work with the button? i followed the same method for button. i added the script to (canvas-button-text) here i have added the script to" button ". the issue is "the reticle does not detects the button". the reticle moves separately . it cannot be pointed on the button. how to solve this issue? plase do reply
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.EventSystems;
public class time : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler {
public float gazeTime = 2f;
private float timer = 0f;
private bool gazedAt = false;
// Use this for initialization
void Start () {
}
void Update(){
if (gazedAt)
{
timer += Time.deltaTime;
if (timer >= gazeTime)
{
SceneManager.LoadScene("OtherSceneName");
timer = 0f;
}
}
}
public void ss(string scenetochangeto)
{
gameObject.SetActive (true);
}
public void OnPointerEnter(PointerEventData eventData)
{
//Debug.Log("pointer enter");
gazedAt = true;
}
public void OnPointerExit(PointerEventData eventData)
{
//Debug.Log("pointer exit");
gazedAt = false;
}
}
Your answer
Follow this Question
Related Questions
Someone please help me with combination lock 0 Answers
How to catch events from scripted buttons 1 Answer
Adding buttons as components not working 0 Answers
Unity project build issue 0 Answers
Button calls itself numerous times 0 Answers