How do I set my public class as a object?

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;

[SerializeField]
public class DialogueManager : MonoBehaviour
{

public Queue sentences;

// Use this for initialization
void Start()
{
sentences = new Queue();
}

public void StartDialogue (Dialogue dialogue)
{
UnityEngine.Debug.Log("Starting Conversation with " + dialogue.name);

sentences = new Queue();

foreach (string sentence in dialogue.sentences)
{
sentences.Enqueue(sentence);
}

DisplayNextSentence();
}

public void DisplayNextSentence()
{

}
}
This is the code im trying to write and its telling me this:
NullReferenceException: Object reference not set to an instance of an object
DialogueTrigger.TriggerDialogue () (at Assets/DialogueTrigger.cs:13)

DialogueTrigger script:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DialogueTrigger : MonoBehaviour
{
public Dialogue dialogue;

public void TriggerDialogue ()
{
UnityEngine.Object.FindObjectOfType().StartDialogue(dialogue);
}
}

Did you mean Class like that every other class can access ?

Please use code tags.

The error message points to line 13 of your DialogueTrigger script. Since code tags weren’t used in the post, I’m guessing line 13 is this:
UnityEngine.Object.FindObjectOfType<DialogueManager>().StartDialogue(dialogue);

  • Check if you have a DialogueManager instance in the scene.
  • Check if you’ve assigned the DialogueTrigger’s “dialogue” reference in the inspector.