void OnDestroy()
 {
     if (_renderToTexture != null)
     {
         PVRSession.UnregisterColorBuffer(_renderToTexture.GetNativeTexturePtr());
     }
 }
 void EnsureRenderTarget()
 {
     if (_renderToTexture == null && PVRSession.instance.ready)
     {
         pvrSizei size = PVRSession.instance.renderTargetSize;
         _renderToTexture = new RenderTexture(size.w, size.h, 24, RenderTextureFormat.Default);
         if (QualitySettings.antiAliasing > 0)
         {
             _renderToTexture.antiAliasing = QualitySettings.antiAliasing;
         }
         _camera.targetTexture = _renderToTexture;
         _renderToTexture.Create();
         PVRSession.RegisterColorBuffer(_renderToTexture.GetNativeTexturePtr());
     }
 }
 void Awake()
 {
     //if an instance of this singleton does not exist, set the instance to this object and make it persist
     if (_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         //if an instance of this singleton already exists, destroy this one
         if (_instance != this)
         {
             Destroy(this.gameObject);
         }
     }
 }