private void ChangeCanvasEventCamera(WVR_DeviceType _dt) { var _objects = GameObject.FindGameObjectsWithTag(CanvasTag); if (_objects == null) { #if UNITY_EDITOR Debug.Log("WaveVR_CombinedInputModule::ChangeCanvasEventCamera, objects with tag [" + CanvasTag + "] are not found."); #endif Log.e(LOG_TAG, "ChangeCanvasEventCamera, objects with tag [" + CanvasTag + "] are not found."); return; } Camera _event_camera = null; switch (_dt) { case WVR_DeviceType.WVR_DeviceType_Controller_Right: _event_camera = (Camera)RightController.GetComponent(typeof(Camera)); break; case WVR_DeviceType.WVR_DeviceType_Controller_Left: _event_camera = (Camera)LeftController.GetComponent(typeof(Camera)); break; default: _event_camera = (Camera)GazeCamera.GetComponent(typeof(Camera)); break; } if (_event_camera == null) { #if UNITY_EDITOR Debug.Log("WaveVR_CombinedInputModule::ChangeCanvasEventCamera, no event camera!"); #endif Log.e(LOG_TAG, "ChangeCanvasEventCamera, no event camera!"); return; } foreach (GameObject o in _objects) { Canvas _canvas = (Canvas)o.GetComponent(typeof(Canvas)); if (_canvas != null) { if (_dt != WVR_DeviceType.WVR_DeviceType_HMD) { Log.d(LOG_TAG, "Change " + _canvas.name + " canvas event camera to " + _dt); } _canvas.worldCamera = _event_camera; } } }
public void Awake() { Instance = this; }