- Home /
How do I make a look at over time button for Oculus rift and Gear VR?
I am Developing a VR experience and I am running into a problem. I want to make a look at button over time. When 2 seconds = 0 I want to load a new scene. This is what I have so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class LookAtOverTime : MonoBehaviour {
public Image BackgroundImage;
public Color NormalColor;
public Color HighlightColor;
public string LevelToLoad;
public float timer = 2f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void OnGazeEnter() {
BackgroundImage.color = HighlightColor;
timer -= Time.deltaTime;
if (timer <= 0)
{
SceneManager.LoadScene(LevelToLoad);
}
}
public void OnGazeExit() {
BackgroundImage.color = NormalColor;
}
}
Can someone help me?
Comment