I made sure to copy the code exactly as per the video, but I keep getting null reference errors coming from the dialogue script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace RPG.Dialogue
{
[CreateAssetMenu(fileName = "New Dialogue", menuName = "Dialogue", order = 0)]
public class Dialogue : ScriptableObject
{
[SerializeField]
List<DialogueNode> nodes;
#if UNITY_EDITOR
private void Awake()
{
if (nodes.Count == 0) //error is referencing this line
{
nodes.Add(new DialogueNode());
}
}
#endif
public IEnumerable<DialogueNode> GetAllNodes()
{
return nodes;
}
}
}
I can’t quite pinpoint the reason why it won’t create a default node?