From the course: Unity 5: Build a Character Dialogue System

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Create the narrative event class

Create the narrative event class - Unity Tutorial

From the course: Unity 5: Build a Character Dialogue System

Start my 1-month free trial

Create the narrative event class

- [Narrator] Let's open up the event one JSON file in MonoDevelop. In order to map our JSON data to an object we can use inside unity, we need to have a specific blueprint for the objects themselves. That's where our narrative event class is going to come in. Back in our scripts folder, let's create a new script. Right click, create, C sharp script. Name this narrative event. Open that up in MonoDevelop as well. We're going to delete everything but the using directives so we have a clean slate. Go ahead and save that. The great thing about using JSON is that we know exactly how this class needs to look. The JSON file only has one root array, called dialogues, which contains a list of dialogue objects. We need to write our narrative event class to match the JSON file for LitJSON to work properly. Back in our narrative event script, let's start out by declaring the class. Public class narrative event. Inside, we're going to have a public list of type dialogue. We're going to call this…

Contents