Start Function Not Updating Video Player Frame

I’m setting up a Main Menu and we have a video we want to skip through when we return to the menu from game. For some reason I’m not sure why when I try to update the frame within the start function it doesn’t recognised that I have changed the frame.

Code to Return to the Main Menu

    IEnumerator SceneMainMenu()
    {
        // Set Load Panel To active 
        loadingScreenObj.SetActive(true);
        async = SceneManager.LoadSceneAsync("Main_Menu");
        async.allowSceneActivation = false;
        Time.timeScale = 1f;
        returnToMainMenu = "Yes";
        PlayerPrefs.SetString("Return", returnToMainMenu);
        while (async.isDone == false)
        {
            slider.value = async.progress;
            if (async.progress == 0.9f)
            {
                slider.value = 1f;
                async.allowSceneActivation = true;
                
            }
            yield return null;
        }
    }

Main Menu Code In Question

    void Start()
    {
        int startFrame = 0;
        float i = 17;
        returnFromInGame = PlayerPrefs.GetString("Return", "No");
        Debug.Log(returnFromInGame);
        if (returnFromInGame == "Yes")
        {
            startFrame = 445;
            i = 1;
        }
        SetupCoroutine(i, startFrame);
        PlayerPrefs.DeleteKey("Return");
    }

    private void SetupCoroutine(float i , int j)
    {
        Debug.Log("Coroutine Runtime : "+ i);
        Debug.Log("frame to skip to : "+j);
        MenuVid.GetComponent<VideoPlayer>().frame = j;
        StartCoroutine(ButtonAnimationTime(i));
        Debug.Log("Current Frame : "+ MenuVid.GetComponent<VideoPlayer>().frame);
    }

    IEnumerator ButtonAnimationTime(float i)
    {
        for (int j = 0; j < buttonList.Count; j++)
        {
            buttonList[j].SetActive(false);
        }
        yield return new WaitForSeconds(i);
        for (int j = 0; j < buttonList.Count; j++)
        {
            buttonList[j].SetActive(true);
        }
    }

I have fixed the issue. As the Video hasn’t loaded I have had to change where we skip the the frame.

I have change the function to Awake and removed the Coroutine out of the start function and added a Boolean to check if we’ve return from the game.

    void Awake()
    {
        returnFromInGame = PlayerPrefs.GetString("Return", "No");
        Debug.Log(returnFromInGame);
        MenuVid.GetComponent<VideoPlayer>().Play();
        if (returnFromInGame == "Yes")
        {
            skipFrame = true;
        }
        PlayerPrefs.DeleteKey("Return");
    }

In the Update function I’m checking if the Video is Playing and if the Boolean to Skip the frame is true it will skip though to the correct frame. Then make the Boolean false or you’ll end up in a loop

    void Update()
    {
        if (MenuVid.GetComponent<VideoPlayer>().isPlaying && skipFrame)
        {
            SetupCoroutine(1, 445);
            skipFrame = false;
        } else if (Input.GetMouseButtonDown(0) && MenuVid.GetComponent<VideoPlayer>().frame <= 295)
        {
            StopAllCoroutines();
            SetupCoroutine(6, 295);
        } else if (Input.GetMouseButtonDown(0) && MenuVid.GetComponent<VideoPlayer>().frame <= 445)
        {
            StopAllCoroutines();
            SetupCoroutine(1, 445);
        }
    }