void Start()
    {
        _streamingAssetsPlaceholderVideoName = System.IO.Path.Combine(Application.streamingAssetsPath, _streamingAssetsPlaceholderVideoName);
        _previewer = new GamePreviewDisplayTexture(_videoDisplay);

        //_playGameButton.onClick.AddListener();
        _playGameButton.onClick.AddListener(() =>
        {
            ProcessRunner.instance.StartGame(currentGameData);
        });

        _nextGameButton.onClick.AddListener(() =>
        {
            _currentSelectedGameIdx++;
            _currentSelectedGameIdx %= GameCatalog.Instance.gameCount;
            refreshVisuals();
        });
        _prevGameButton.onClick.AddListener(() =>
        {
            _currentSelectedGameIdx--;
            _currentSelectedGameIdx += GameCatalog.Instance.gameCount;
            _currentSelectedGameIdx %= GameCatalog.Instance.gameCount;
            refreshVisuals();
        });
        refreshVisuals();
    }
    public void setDisplayedGame(GameData game, int direction)
    {
        GamePreviewDisplayTexture targVideoPlayer = thingToShow == videoPlayer1 ? videoPlayer2 : videoPlayer1;

        var outgoingVideo = thingToShow;

        targVideoPlayer.alpha = 0;

        targVideoPlayer.setVideo(game, placeHolderVideoUrl);

        prevThingToShow = thingToShow;
        thingToShow     = targVideoPlayer;

        animateChangedObject(direction);
    }
    // Use this for initialization
    void Awake()
    {
        _instance = this;


        this.videoPlayer1 = new GamePreviewDisplayTexture(previewTex1);
        this.videoPlayer2 = new GamePreviewDisplayTexture(previewTex2);


        _allFadeables = new GamePreviewDisplayTexture[] { videoPlayer1, videoPlayer2 };

        //zero out all fadeables
        //so an irrelevant one doesn't block an active one
        foreach (GamePreviewDisplayTexture f in _allFadeables)
        {
            f.alpha = 0;
        }
    }
    // Update is called once per frame
    void Update()
    {
        blurUpdate();


        bool thingToShowIsAVideo = !string.IsNullOrEmpty(thingToShow._videoPlayer.url);

        float targetAlpha = 0;

        if (!thingToShowIsAVideo)
        {
            if (thingToShow != null)
            {
                targetAlpha = 1;
            }
        }
        else //thing to show is a video
        {
            //wait for the video player to be ready?
            GamePreviewDisplayTexture vidToShow = ((GamePreviewDisplayTexture)thingToShow);

            if (vidToShow._videoPlayer.isPrepared)//&& !vidToShow.isSeeking)
            {
                targetAlpha = 1;

                /*if (vidToShow.alpha == 0)
                 * {
                 *  vidToShow.videoPlayer.time = (double)Random.Range(0, 100);
                 *
                 * }*/
            }



            if (!vidToShow._videoPlayer.isPlaying && vidToShow._videoPlayer.isPrepared)    // && vidToShow.transform.GetSiblingIndex() != vidToShow.transform.parent.childCount -1)
            {
                vidToShow._videoPlayer.transform.SetAsLastSibling();
            }



            //
        }

        thingToShow.alpha = Mathf.MoveTowards(thingToShow.alpha, targetAlpha, Time.deltaTime / .65f);

        foreach (GamePreviewDisplayTexture f in _allFadeables)
        {
            if (f == thingToShow)
            {
                //f.alpha = 1;
            }
            else if (f != prevThingToShow)
            {
                //f.alpha = 0;
            }
            else if (f == prevThingToShow)
            {
                // f.alpha = 1;// - thingToShow.alpha;
            }
        }


        //videoPlayer1.alpha = thingToShow == videoPlayer1 ? 1 : 0;
        //image1.alpha = thingToShow == image1 ? 1 : 0;
    }