Unity:2017.2.0f3
Android SDK:2.3.2
Java:1.8
GVR SDK:1.70
这是我的工具版本。
我想凝视点击。但它可以在Unity工作,但它不适用于Android手机。
我的目光是点击代码..plze解决这个问题
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
public class gaze : MonoBehaviour
{
bool gazeat = false;
public float MyTime = 0.0f;
public Transform RadialProgress;
RaycastHit hit;
void Start()
{
MyTime = 0.0f;
RadialProgress.GetComponent<Image>().fillAmount = MyTime / 2;
}
public void reset()
{
MyTime = 0.0f;
RadialProgress.GetComponent<Image>().fillAmount = MyTime / 2;
}
void Update()
{
MyTime += Time.deltaTime;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RadialProgress.GetComponent<Image>().fillAmount= MyTime/2;
if (MyTime >= 2.0f)
{
if (Physics.Raycast(ray, out hit))
{
ExecuteEvents.Execute(hit.transform.gameObject, new PointerEventData(EventSystem.current), ExecuteEvents.pointerDownHandler);
reset();
this.enabled = false;
}
}
}
}