Creating an instruction data model
Now that we have a UI and a controller, we're ready to round out our MVC architecture and define the data model. We will first define an InstructionStep
class that represents the data for one of the instructions steps. Then we'll define an InstructionModel
, which has the list of steps used in the app.
InstructionStep class
We'll get started by creating a new C# script named InstructionStep
, which will basically be a data structure or container for a row of data from our spreadsheet (in CSV format), including fields the for title, body text, image, and video.
- In the Project
Assets/HowToChangeATire/Scripts
folder, right-click and create a newC# Script
and name itInstructionStep
. - Open it for editing.
When Unity creates a new script it uses a default template for a typical object class derived from MonoBehaviour
. We want this to be just a simple object and do not want it to be a MonoBehaviour
(and do not need the Start
/Update
functions).
File: InstructionStep.cs...