Unable to access a list in Godot without error. C#

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By The Glitch

When i attempt to do anything with a list it gives me the following error:

System.NullReferenceException: Object reference not set to an instance of an object.

Here is code:

using Godot;
using System;
using System.Collections.Generic;

public partial class TurnQueue : Node2D
    List<string> CharQueue;

    public override void _Ready()

    // Called every frame. 'delta' is the elapsed time since the previous frame.
    public override void _Process(double delta)
:bust_in_silhouette: Reply From: jgodfrey

You’ve only said that CharQueue will be of type List<string> but you haven’t actually created the collection itself. You want:

List<string> CharQueue = new List<string>();

Never would of figured that out, thanks.

The Glitch | 2023-03-13 00:20