virtual-reality

Enable/Disable VR from code

白昼怎懂夜的黑 提交于 2019-11-26 06:48:00
问题 How can I set the display to stereoscopic programmatically in Unity for an app deployed to an Android device? I want a UI menu where the user can toggle between \"VR mode\" and normal mode. I do not want VR mode by default as it should be an option at run-time. I know there is a setting for \"Virtual Reality Supported\" in the build settings, but again, I do not want this enabled by default. 回答1: Include using UnityEngine.XR; at the top. Call XRSettings.LoadDeviceByName("") with empty string

Unity - pass data between scenes

梦想的初衷 提交于 2019-11-26 02:22:44
问题 How can I pass score value from one scene to another? I\'ve tried the following: Scene one: void Start () { score = 0; updateScoreView (); StartCoroutine (DelayLoadlevel(20)); } public void updateScoreView(){ score_text.text = \"The Score: \"+ score; } public void AddNewScore(int NewscoreValue){ score = score + NewscoreValue; updateScoreView (); } IEnumerator DelayLoadlevel(float seconds){ yield return new WaitForSeconds(10); secondsLeft = seconds; loadingStart = true; do { yield return new