Dialog system

I’ve built a dialog system through some tutorials, the problem I’m currently having is that I can’t assign the dialogueData to the dialogueManager, I don’t know what the problem is, forgive me for my stupidity, it’s my first time with unity and c#!
image

dialogueManager script:
using System.Collections;
using UnityEngine;
using System.Collections.Generic;
using UnityEngine.UI;
using TMPro;

namespace DialogueSystem
{
public class DialogueManager : MonoBehaviour
{
    public DialogueData dialogueData;
    public TextMeshProUGUI dialogueText;
    public Image dialogBox;

    public int currentNodeIndex = 0;
    public bool dialogueActive = false;

    public void Start()
    {
        StartDialogue(0); // Start with the first dialogue node (index 0)
    }

    public void StartDialogue(int startNodeIndex)
    {
        currentNodeIndex = startNodeIndex;
        dialogueActive = true;

        DisplayCurrentDialogue();
    }

    public void SelectAnswer(int answerIndex)
    {
        if (dialogueActive)
        {
            DialogueData.DialogueNode currentNode = GetDialogueNode(currentNodeIndex);
            if (currentNode != null && answerIndex >= 0 && answerIndex < currentNode.answerOptions.Count)
            {
                int nextNodeIndex = currentNode.nextNodeIndices[answerIndex];
                if (nextNodeIndex >= 0 && nextNodeIndex < dialogueData.dialogueNodes.Count)
                {
                    currentNodeIndex = nextNodeIndex;
                    DisplayCurrentDialogue();
                }
                else
                {
                    EndDialogue();
                }
            }
        }
    }

    public DialogueData.DialogueNode GetDialogueNode(int nodeIndex)
    {
        if (nodeIndex >= 0 && nodeIndex < dialogueData.dialogueNodes.Count)
        {
            return dialogueData.dialogueNodes[nodeIndex];
        }
        return null;
    }

    public void EndDialogue()
    {
        dialogueActive = false;
        // Add any other end of dialogue actions you need
    }

    public void DisplayCurrentDialogue()
    {
        DialogueData.DialogueNode currentNode = GetDialogueNode(currentNodeIndex);
        if (currentNode != null)
        {
            dialogueText.text = currentNode.question;
            dialogBox.gameObject.SetActive(true);
        }
    }

    public void HideDialogue()
    {
        dialogBox.gameObject.SetActive(false);
    }

    // Update is not needed in this script

    // Add any other methods or functionality you need for the dialogue system
}
}

dialogueData script:

using System.Collections;
using UnityEngine;
using System.Collections.Generic;
    
namespace DialogueSystem
{
[CreateAssetMenu(fileName = "New Dialogue Data", menuName = "Dialogue System/Dialogue Data")]
public class DialogueData : ScriptableObject
{
    [System.Serializable]
    public class DialogueNode
    {
        public string question;
        public List<string> answerOptions;
        public List<int> nextNodeIndices;
    }

    public List<DialogueNode> dialogueNodes = new List<DialogueNode>()
    {
        // Define your dialogue nodes here
        new DialogueNode()
        {
            question = "Q1: What is the main problem in the current situation?",
            answerOptions = new List<string>()
            {
                "1. Omar’s doctor has informed him that he has slightly high cholesterol",
                "2. Omar’s friends are ready to order and he has not decided what he wants yet",
                "3. Omar cannot decide if he should order the Extra Cheesy Chicken Parmesan or the Chicken Teriyaki Stir-Fry."
            },
            nextNodeIndices = new List<int>() { 1, 0, 0 }
        },

I didn’t yet read your code properly, but I’ll take a guess based on quick glance of code and images.

If your DialogueData is scriptable object type, you’ll first have to create a scritable object asset file out of it.

From this line you see where it goes in menu, and what file name will be given to it:

[CreateAssetMenu(fileName = "New Dialogue Data", menuName = "Dialogue System/Dialogue Data")]

So to create a scriptable object asset of your Dialogue Data, right mouse click in asset folder and pick it from Dialogue System/Dialogue Data menu.

Then assign this asset file in your field.

Seems like the DialogueData class you pasted here is incomplete so it is hard to say if there is something wrong.