Improve Your Unity Code with MVC/MVP Architectural Patterns

preview_player
Показать описание
Demystify MVP and MVC Architecture for Unity in simple terms focusing on the Separation of Concerns and a practical example building an MMO style hotbar using a Model, View and Controller.

#unity3d #gamedev #indiedev

▬ Contents of this video ▬▬▬▬▬▬▬▬▬▬

0:00 MVC/MVP Overview
3:51 Hotbar Overview
4:17 Model
6:17 View
9:30 Controller

*Source code:*

Assets Shown In This Video (Affiliate Links)

*Follow me!*
Рекомендации по теме
Комментарии
Автор

Hey everyone, hope you find this video helpful in understanding Separation of Concerns with the MVC or MVP patterns. Code links are in the description. Let me know if you have more questions and if we need a 3rd episode on this topic!

git-amend
Автор

Finally found a tutorial that not only talks about the three core MVC components, but also shows how to create and connect them. Really helpful.

carlwong
Автор

Great explanation and contextualization, as always.
MVC, MVP, and MVVM are staples of proper UI architecture in video games.
I'm glad that someone is finally taking the time to show people an actual implementation of one of them.

Hersatz
Автор

First thing, great video!
I have been working as an Android Developer for 7 years now, implementing MVC, MVP and then MVVM in all my projects.

One note about the video, It is not best practice to tightly couple the Controller to the view, as then you lose what you wanted, which is separation of concerns.
In order to achieve that, you could use the Observer pattern and remove the dependency of the view from the controller.

This is desirable because it makes the code more testable, and you get the extra benefit that if you are going to make changes to your view, no changes are needed to your controller as it is truly separated.

I love your videos. I started my long-standing dream of game development and have been glued to all your videos since. Keep up the great work! 👍

orbalmas
Автор

Thank you for this super-useful video! Every time I see an update on your channel, I immediately know that there's a new video worth watching. Please keep up the good work!

IdealIdleIncremental
Автор

Your videos work for me as glue. Making all that I have learned come together. Now I have a new perspective and that's a big help, more than I could ask. Thank you very much.

jvizcode
Автор

It is rare to have unity tutorials that go this deep. But this is exactly what I need to get to the next level! Thanks alot!

I just feel like having the videos in a series might be a good idea? When I watch this video there are some things I missed and having a structure/order in which to go through the videos would be great! Even if the reality is to watch all of them, episode number for example would indicate it well. But I understand the title has other needs as well...

VladaPersonal
Автор

you're the greatest man, I needed this so much! I've been doing this all the time in my past years on web development, it didn't occur to me to try something similar for game development, this is great, thanks

kln
Автор

Incredibly well done. The way you showed the diagram first, explained it, then jumped back and forth between code and diagram to show which part was being implemented was really helpful. Just found your channel, looking forward to checking out the rest of your content. Keep up the great work!

jordanbarker
Автор

Another great video, I need to implement it to get my head around it though.

I'd be interested to see you go through a set of tutorials where you build out a game using the patterns, like a vertical slice of a game using the patterns. Would be a huge amount of work though I'd expect, and I would assume you already have plenty on your plate :D. Could be a paid course, I'd definitely pay for it.

Broudy
Автор

Loved the Unity Game Architecture series! Suggesting a playlist reorder for better flow: Start with 'SIMPLE Tip, ' then 'Improve Your Unity Code with MVC/MVP, ' and end with 'Learn Unit Testing.' Amazing work and best wishes!

Oguzhan-lz
Автор

Another great video! Glad to see there is at least one Unity youtuber who writes modern code.

TheArghnono
Автор

Your videos are fantastic keep it up 🙌

baselpro
Автор

Thank you for the detailed walkthrough. It would be awesome if you can introduce how to structure MVVM and data binding in Unity.

echoness_
Автор

This is something I've heard for quite a while and seen a bit of it but never understand what it really is and how to really implement it, thank you for this video to make me understand a bit of it, might need to watch it couple times so i can really grasp the true idea, but as always a great video from Adam.. keep it up man, i know u will be big 😄

junaidywijaya
Автор

Great content as always, said it before, but it is so great to have these intermediate videos in sea of for-beginner stuff! One question - in a game like Dragon age, where player can switch between different characters, would you have the MVC/MVP combo for each of the characters, or would you have just one and build the switching logic inside? Having it for each of the characters makes more sense for me, but id like to know your perspecitve :) Thanks!

MaxVinopalDev
Автор

finally someone is using diagrams for teaching and telling. The diagram at 4:00 makes many things clear.

halivudestevez
Автор

I've always found the terminology around MCV to be rather unintuitive, but if I understand correctly, it's basically just saying to keep your Logic, Data, and Visuals all separate from each other.

MarushiaDark
Автор

Seriously, thank you so much for putting out this level of content.

antijulius
Автор

I hopr some people can learn from my mistake: I used the Event-Bus inside a system, which lead to a confjsing structure inside a mvp system. I learned that the Event-Bus is very nice for communicating between different mvp systems. Inside a system I used then simple public Actions on my view that forwards the events to the presenter and the presenter decodes what to do.

I dont know if this is the best approach, but it worked pretty well for me.

mhouney