void Stop()
 {
     // Only stop the main instance, since it is the only one that
     // ever actually starts-up.
     if (this == instance)
     {
         if (null != _clientObject)
         {
             Debug.Log("[PVR-Unity] Shutting down PVR.");
             _clientObject.Dispose();
             _clientObject = null;
         }
         if (null != _renderlib)
         {
             _renderlib.CloseRenderLib();
             _renderlib = null;
         }
     }
 }
            // Use this for initialization
            void Start()
            {
                if (!_dllFixed)
                {
                    DLLSearchPathFixer.fix();
                    _dllFixed = true;
                }

                if (_clientObject == null)
                {
                    Debug.Log("[PVR-Unity] Starting");
                    _clientObject = new PVR.PVRClient();
                    if (!_clientObject.init())
                    {
                        Debug.LogError("[PVR-Unity] PVR Session init failed. Start PVR Server and restart the application.");
                        _errMsg = "Failed to init PVR Session.";
                        return;
                    }
                }
                if (_renderlib == null)
                {
                    if (!PVRRenderLib.IsRenderLibSupported())
                    {
                        _errMsg = "PVR render lib not support.";
                        return;
                    }
                    _renderlib = new PVRRenderLib();
                    if (!_renderlib.InitRenderLib())
                    {
                        Debug.LogError("[PVR-Unity] PVR RenderLib init failed.");
                        _errMsg = "Failed to init PVR render lib.";
                        return;
                    }
                }

                Screen.sleepTimeout = SleepTimeout.NeverSleep;
                pvrDisplayInfo info = new pvrDisplayInfo();

                if (_clientObject.getEyeDisplayInfo(pvrEyeType.pvrEye_Left, ref info) != pvrResult.pvr_success)
                {
                    Debug.LogError("[PVR-Unity] getHmdDisplayInfo failed.");
                    return;
                }
                Application.targetFrameRate = (Int32)info.refresh_rate;

                pvrEyeRenderInfo renderInfo = new pvrEyeRenderInfo();

                if (_clientObject.getEyeRenderInfo(pvrEyeType.pvrEye_Left, ref renderInfo) != pvrResult.pvr_success)
                {
                    Debug.LogError("[PVR-Unity] getEyeRenderInfo failed.");
                    return;
                }
                if (_clientObject.getFovTextureSize(pvrEyeType.pvrEye_Left, renderInfo.Fov, 1.0f, ref _renderTargetSize) != pvrResult.pvr_success)
                {
                    Debug.LogError("[PVR-Unity] getFovTextureSize failed.");
                    return;
                }
                _ready = true;
                UpdateRenderInfo();
                UpdateHmdPose();
                UpdateInputState();
            }