I’m not real familiar with the lingo for scripting and i’m sure if I knew the correct word to search for I would find what I’m looking for. What is the language that will trigger an event after you look at the object for a few seconds?
I’m trying to create a Gear VR Drive in theater and when you look at the theater screen for like 3 seconds it will load a full screen video. I read that you can’t have a movieTexture in a VR environment in Unity so I figured I’d just make it load a new scene where the movie is in full screen.
So I think I may have found what I am looking for but I need some help tailoring it to OVR Camera as I’m getting a “NullReferenceException Object reference not set to an instance of an object” error. And I think it’s because I’m not using the standard MainCamera.
Created a JS with:
#pragma strict
//Type the name of the scene to load in the inspector.
var MovieTestScene : String ;
var hit: RaycastHit;
function Update (){
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Input.GetMouseButtonDown(0)){
if (Physics.Raycast (ray, hit , Mathf.Infinity)){
if (hit.collider.name == "ViewScreen") { Application.LoadLevel(MovieTestScene); }
} } }
So the Console error points to line 10 which is:
var ray = Camera.main.ScreenPointToRay …
What do I need to change in here to reference the Camera of the OVRPlayerController, I tried changing “Camera” and “main” to OVRPlayerController and OVR CameraRig but that didn’t fix it