我正在使用Unity + Vuforia进行AR / VR场景,我的VR场景由触发器调用,在场景之后我想回到AR。
public class GameManager : MonoBehaviour {
public static GameManager instance;
public GameObject[] planes;
public TransitionManager mTransitionManager;
public VideoPlayer[] vps;
public void Awake(){
instance = this;
}
// Use this for initialization
void Start () {
vps = new VideoPlayer[4];
for (int i = 0; i < 4; i++) {
vps [i] = planes [i].GetComponent<VideoPlayer> ();
ARPort.SetActive (false);
}
StartCoroutine (StartSequence ());
}
// Update is called once per frame
void Update () {
}
IEnumerator StartSequence(){
//Wait for video [0] to finish
yield return new WaitForSeconds((float)vps[0].clip.length);
Destroy (planes [0]);
planes [1].SetActive (true);
//Wait for video [1] to finish
yield return new WaitForSeconds((float)vps[1].clip.length);
Destroy (planes [1]);
planes [2].SetActive (true);
//Wait for video [2] to finish
yield return new WaitForSeconds((float)vps[2].clip.length);
Destroy (planes [2]);
planes [3].SetActive (true);
//Wait for video [3] to finish
yield return new WaitForSeconds((float)vps[3].clip.length);
Destroy (planes [3]);
//Now start AR part again
MixedRealityController.Instance.SetMode (MixedRealityController.Mode.HANDHELD_AR);
}
此代码启动相机几毫秒,之后再次打开VR场景。我怎样才能解决这个错误?