【发布时间】:2017-05-04 06:09:46
【问题描述】:
我正在使用Unity 开发一个应用程序,其中我创建了两个Scene's。如果用户凝视Scene 1 中的一个对象,它应该转到Scene 2。我有下面的代码,但我得到了错误。
源代码:-
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class time : MonoBehaviour {
public float gazeTime = 2f;
private float timer;
private bool gazedAt;
// Use this for initialization
void Start () {
}
void update(){
if (gazedAt)
{
timer += Time.deltaTime;
if (timer >= gazeTime)
{
Application.LoadLevel (scenetochangeto);
timer = 0f;
}
}
}
public void ss(string scenetochangeto)
{
gameObject.SetActive (true);
}
public void pointerenter()
{
//Debug.Log("pointer enter");
gazedAt = true;
}
public void pointerexit()
{
//Debug.Log("pointer exit");
gazedAt = false;
}
public void pointerdown()
{
Debug.Log("pointer down");
}
}
【问题讨论】:
标签: c# string unity3d gameobject gaze-buttons