} //END Awake //-------------------------------// private void CheckIfXRCameraExists() //-------------------------------// { if( xrCamera == null && GetComponentInChildren<XRCamera>() != null ) { xrCamera = GetComponentInChildren<XRCamera>(); } } //END CheckIfXRCameraExists
//----------------------------------------// public void CreateCamera() //----------------------------------------// { //Check if we should remove any existing cameras if( destroyExistingCameras ) { DestroyCurrentCameras(); } //Instantiate a copy of the camera reference GameObject prefab = GetCameraPrefab(); GameObject go = Instantiate( prefab, transform ); go.name = prefab.name; xrCamera = go.GetComponent<XRCamera>(); } //END CreateCamera