Use the Model-View-Controller design pattern with Unity 5.6
4.5 (44 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
239 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Use the Model-View-Controller design pattern with Unity 5.6 to your Wishlist.

Add to Wishlist

Use the Model-View-Controller design pattern with Unity 5.6

Develop a "Guitar Hero like" game with Unity 5.6. Part 1 : Design Pattern
4.5 (44 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
239 students enrolled
Created by Fred Moreau
Last updated 7/2017
Curiosity Sale
Current price: $10 Original price: $35 Discount: 71% off
30-Day Money-Back Guarantee
  • 2.5 hours on-demand video
  • 2 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Implement a Model-View-Controller pattern with Unity.
  • Design custom patterns/architecture.
  • Create a custom reusable asset type with ScriptableObject.
  • Instantiate Prefabs UI objects to populate a UI View.
  • Implement a Singleton (unique instance) pattern.
  • Use custom inputs (keyboard, gamepads) to trigger events.
  • Implement tempo based game mechanics.
View Curriculum
  • Being familiar with Unity Editor
  • Have a fair knowledge of C# and MonoDevelop (or Visual Studio)

This training is the first of a series of training on Unity, focusing on team work between designers, artists and programmers.

Every training in this series will touch on a specific subject of the game industry.
This course will touch on design patterns, and especially the model-view-controller pattern and how to implement it with Unity.

We're going to start from scratch to build a Guitar Hero, or Tap Tap Revenge like game.
We'll touch on data structure and gameplay mechanics, which overlap design and programming, and data-gameplay graphics, which overlaps art and programming.

We'll begin with a quick overview of the known patterns (MVC, MVVM, MVP)
Then, we'll mock up the view with Unity UI tools, before we work on the game architecture.

We'll design the Track Data structure (Model), then we'll display and edit it with a Custom Inspector, and randomly generate sample data to work with. We'll touch on reusable data with the ScriptableObject class.

We'll then work on the Track View, populate it with prefabs UI objects, and animate it.

We'll then work on the GamePlay Controller, that'll handle inputs from the Player and all Game Play mechanics, and update the view so the Player knows how he's doing.

At the end of the course, artists will know better what they can do with UI components, and programmers and designers will know how they can author custom game data, right from the editor, for use at runtime.

Who is the target audience?
  • Unity developers willing to become experts
  • App developers willing to use their knowledge with Unity
Students Who Viewed This Course Also Viewed
Curriculum For This Course
21 Lectures
Project Overview
4 Lectures 09:02

Fred Moreau, Game Developer, Unity Instructor and Agile Coach.

Preview 01:22

Unity Workshops Series Overview.

Preview 00:28

Quick overview of this training course.

Preview 00:35

In this video, we have a quick overview of our game design, and a bit of theory on design patterns like Model-View-Controller, Model-View-ViewModel and Model-View-Presenter.

Preview 06:37
Mocking up the View
2 Lectures 16:40

In this video, we're mocking up the 3D Track View using Unity UI Tools.

Mocking up the Track View

In this video, we're saving UI objects as Prefabs to populate the view with later.

Saving UI elements as Prefabs
Track Data (Model)
5 Lectures 42:24

Let's work on the Model, the shape of the data.

Shaping the Track data (Model).

We need to separate the data (the music) from the component (the music player).

Separating the data from the component.

We can now create a new custom asset type to store our music tracks.

Turning the data into a custom asset type. (ScriptableObject)

To work on other components we need some sample data. Before we can author the data, let's generate some randomly.

Generating Random Test Data.

To generate and author custom data within the Editor, let's implement a Custom Inspector for the Track class.

Editing the data with a Custom Property Inspector.
Track View
3 Lectures 18:42

We now need to create a new TrackView component.

Setting up the TrackView component.

Now that we have sample data and a Track View mockup, we can populate the view with the Prefabs.

Reading Track data and populating the TrackView with Prefabs object.

Before working on the Controller, let's add some motion to the Track View.

Animating the TrackView scrolling.
GamePlay Controller
5 Lectures 47:18

We're now going to create our Controller class, and use custom inputs using Keycodes.

Handling custom inputs using Keycodes.

We need to implement some tempo mechanics for this rhythm based game.

Implementing Gameplay tempo mechanics.

It's now time to make the game "playable", matching the inputs with the track data.

Implementing Gameplay input controls.

For the game to be playable, the Track View must sync' with the Controller.

Sync'ing the TrackView with the Controller track.

Reading in the console to know how we're doing isn't so rewarding. Let's add some visual feedback to the View.

Adding the Gameplay visual feedback.
Wrap Up
1 Lecture 02:10

We're now done with this prototype. Let's review what we've learnt.

Preview 02:10
1 Lecture 06:00

It was brought to my attention that beatsPerSecond and secondsPerBeat were carrying the opposite meaning.

In this video, I'm showing how to refactor (rename) a member throughout the solution, along with another quick update I added since I recorded the videos.

Refactoring accessors.
About the Instructor
Fred Moreau
4.5 Average rating
129 Reviews
733 Students
7 Courses
Game Developer, Unity Instructor, Agile Coach

Coach and Consultant - Design & Development, Business, Training

[ English ]

With a strong technical expertise and a taste for design, I've had the opportunity to lead teams of creative people through development of innovative projects.

I'm passionate about learning and training, I started giving training early and have been involved in training certification programs. When you work in this industry, sharing your knowledge is not only a duty, it's the opportunity to learn even more.

I'm a self-taught developer myself. I work with Unity since 2011, and was very lucky to meet with mentors who taught me a great deal about OOP. That's a lot to learn about when your background is not in engineering, though, I figured that if I could do it, anyone can.

[ Français ]

Je suis passionné par l’apprentissage et l’enseignement. J’ai donné mes premières formations très tôt et me suis impliqué dans les programmes de certifications de grands éditeurs. Quand on travaille dans cette industrie, partager ses connaissances est plus qu’un devoir, c’est aussi le meilleur moyen d’apprendre d’avantage.

Je suis développeur autodidacte. Je travaille avec Unity depuis 2011 et j’ai eu la chance de rencontrer d’excellents mentors qui m’ont beaucoup appris sur la programmation objet.
C’est beaucoup de choses à apprendre lorsque vous n’avez pas un parcours d’ingénieur. Cependant, si j’y suis parvenu, n’importe qui peut en faire autant.