Wednesday, 16 March 2016

Pure MVC with Unity

Many new Unity users asked but is very simple to make pure MVC:

1. Use only one Root object with Monobehaviour inheritance like start point of whole application
2. Inside this Root object process everything in custom Models that can or not be associated with some GameObjects in scene via Find
3. Access prefabs from Resources and keep everything in Resoure folder + Constants file
4. Separate Contoller like event base non-platform specific event system to process input.

Thats it.

But it makes a lot of troubles working with juniors and designers that want to contoll parameters from the editror not in text file. Solution is to mix MVC with the way Unity propose to code. Like make process code in models and associate it with some kind of data container that inheritance from Monobehaviour and placed on GameObject.

No comments:

Post a Comment