I feel like I should preface this by saying, I am still a beginner and knowing me, I could very well be forgetting something that is ridiculously simple and over complicating in the process. But nonetheless, I have been unable to figure this out.
I’m trying to create a dialogue system in unity that displays a string of text as well as a sprite. However, I am not sure how to pull the string from a separate class while also ensuring that I can keep the class in a list so I can cycle through the text and sprite together. Currently the class I'm attempting to pull from looks like this:
public class DialogueInfo
{
public Sprite emotion;
public string Words;
}
The list looks like this:
public List<DialogueInfo> dialogueInfo = new List<DialogueInfo>();
And I'm trying to use the "Words" string here:
NPC.dialogLines = dialogueInfo.Words;
This however, does not work. I am getting an error saying that "'List<dialogueHolder.DialogueInfo>' does not contain a definition for 'Words' and no accessible extension method..." Any suggestions? This whole process could be a very bad way of doing things and if so, suggestions would be appreciated. If more context is needed, I will gladly provide it.
Note: by using a list i am just trying to keep a format that looks like this: Unity's formatting of a list/array but with both text and a sprite in a single element If I have to use a different approach then that is alright.