Interactive Dialogues activating with end of film

Hello Everyone,

I am building an interactive video, composed of 20 video.clips, the whole idea is that once the first clip finishes, a set of 3 questions appears to the user and depening on the selection the next clip appears.

In the script below I am able to do it, however I know my skills are begginer level so I wonder if you can help me improve the script. My questions are pretty much two:

Q1 - To have the dialogue options at the end of the clip I use “video.frameCount”, i convert it to string and then I use “video.frame”, which I as well translate to string… then when they match, voila, the dialogue object appears. Is there an easier way to achieve this?

Q2 - this interactive expereince has 20 video.clips, the videoplayer source changes the clip with each button selected. Right now I have to create 20 different dialogues (“Dialogue S2”) in the script below, in which I match each video.clip with the gameobject (a UI Button). is there any way to make this more automatic? - its a bit of a workload to do this

any help is welcomed. script below:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;

public class VideoManager : MonoBehaviour
{
    public VideoPlayer video;
    private string framesinpic;

    [Header("Dialogue S2a")]
    public VideoClip S2a;
    public GameObject dS2a;

    [Header("Dialogue S2b")]
    public VideoClip S2b;
    public GameObject dS2b;

    void Update()
    {
        Debug.Log(video.clip.name);
        ulong time = video.frameCount - 10;
        framesinpic = time.ToString();
        Debug.Log(framesinpic);
        Debug.Log(video.frame);

        if(video.clip.name == S2a.name && framesinpic == video.frame.ToString())
        {
            turnonOptions(dS2a);
        }
        if (video.clip.name == S2b.name && framesinpic == video.frame.ToString())
        {
            turnonOptions(dS2b);
        }
        //as you can see... I add manually each if per dialogue..

    }

    void turnonOptions(GameObject a)
    {
        a.SetActive(true);

    }
    public void ChangeVideo(VideoClip x)
    {
        video.clip = x;
    }
}

One way is to use ScriptableObjects to help organize things together, or just make a Script to make prefabs out of what you want. That would let you keep the quiz next to the video and then just slot them into a lost. Check out some ScriptableObject tutorials.

Thanks Kurt. I just watched a scriptable tutorial and seems like this could work… I am looking to develop more advance scenarios with up to 80 different scenes, so any way that i can better organize information will help me a lot