private void CognitiveVR_Manager_OnTick()
        {
            if (CognitiveVR_Manager.HMD != null)
            {
                periodicRenderer = CognitiveVR_Manager.HMD.GetComponent <PlayerTrackerHelper>();

                if (periodicRenderer == null)
                {
                    periodicRenderer         = CognitiveVR_Manager.HMD.gameObject.AddComponent <PlayerTrackerHelper>();
                    periodicRenderer.enabled = false;
                }
                cam = CognitiveVR_Manager.HMD.GetComponent <Camera>();
                cam.depthTextureMode = DepthTextureMode.Depth;
            }

            if (!headsetPresent || CognitiveVR_Manager.HMD == null)
            {
                return;
            }

            RenderTexture rt = null;

            if (CognitiveVR_Preferences.Instance.TrackGazePoint)
            {
                periodicRenderer.enabled = true;
                rt = periodicRenderer.DoRender(new RenderTexture(width, height, 0));
                periodicRenderer.enabled = false;
            }

            PlayerSnapshot snapshot = new PlayerSnapshot();

            snapshot.Properties.Add("position", cam.transform.position);
            snapshot.Properties.Add("gazeDirection", cam.transform.forward);
            snapshot.Properties.Add("nearDepth", cam.nearClipPlane);
            snapshot.Properties.Add("farDepth", cam.farClipPlane);
            snapshot.Properties.Add("time", Time.time);
            snapshot.Properties.Add("renderDepth", rt);

#if CVR_STEAMVR
            if (Valve.VR.OpenVR.Chaperone != null)
            {
                snapshot.Properties.Add("chaperoneVisible", Valve.VR.OpenVR.Chaperone.AreBoundsVisible());
            }
#endif
            playerSnapshots.Add(snapshot);
            if (playerSnapshots.Count >= CognitiveVR_Preferences.Instance.SnapshotThreshold)
            {
                SendData();
            }
        }
        //TODO level loaded stuff should use cognitivevr_manager events

        public override void CognitiveVR_Init(Error initError)
        {
            if (CognitiveVR_Manager.HMD != null)
            {
                periodicRenderer = CognitiveVR_Manager.HMD.GetComponent <PlayerTrackerHelper>();

                if (periodicRenderer == null)
                {
                    periodicRenderer         = CognitiveVR_Manager.HMD.gameObject.AddComponent <PlayerTrackerHelper>();
                    periodicRenderer.enabled = false;
                }
                cam = CognitiveVR_Manager.HMD.GetComponent <Camera>();
                cam.depthTextureMode = DepthTextureMode.Depth;
            }

            if (CognitiveVR_Preferences.Instance.SendDataOnQuit)
            {
                CognitiveVR_Manager.OnQuit += SendData;
            }

#if CVR_STEAMVR
            //if (CognitiveVR_Preferences.Instance.SendDataOnHMDRemove)
            //CognitiveVR_Manager.OnPoseEvent += CognitiveVR_Manager_OnPoseEvent;
#endif

#if UNITY_5_4
            //if (CognitiveVR_Preferences.Instance.SendDataOnLevelLoad)
            SceneManager.sceneLoaded += SceneManager_sceneLoaded;
#endif

            string sceneName = SceneManager.GetActiveScene().name;

            CognitiveVR_Preferences.SceneKeySetting sceneSettings = CognitiveVR.CognitiveVR_Preferences.Instance.FindScene(sceneName);
            if (sceneSettings != null)
            {
                if (sceneSettings.Track)
                {
                    BeginPlayerRecording();
                }
                //else
                //Debug.Log("PlayerRecorderTracker - don't track this scene " + sceneName);
            }
            else
            {
                //Debug.Log("PlayerRecorderTracker - startup couldn't find scene -" + sceneName);
            }
            trackingSceneName = SceneManager.GetActiveScene().name;
        }