MVC in Unity3d example - how to implement ?

Hey,

I have an assignment to implement strict MVC pattern in Unity3d.
I have no problem in doing it in any low level environment but I do have a problem wrapping my head around doing it in Unity.

What I did is:

  • Class GameplayController : MonoBehaviour
    that creates and contains:
    GameplayModel - loads prefabs, moves them around
    GameplayView - loads textures and ui
    (which do not derive from MonoBehaviour)

and I put the GameplayController on camera.

Is that a good way to do it ?


if so: how do I communicate with other scripts like collisionDetection on objects ?

Thanks!

It’s so big topic.
but I don’t agree this

Model maybee the hold game logic(game rule,ect…),pure logic…
View maybee how to display the game logic in visual.
Controller comunicate model and view…one game model can have may views (games)

In every MVC I’ve ever used, the model contains just the data, and the controller is responsible for logic, presenting only calculated values to the View (no logic in view).

An assignment? Like a school assignment? I’m going to go the Stack Overflow route and say you should figure it out yourself if it’s homework.

@KelsoMRK
What a lousy way to post on a forum where people ask for help.
Post constructive help !

@bloodian
Read this page for more info:
http://forum.unity3d.com/threads/35738-How-to-MVC-pattern

I’m more than happy to help (how often do I post in this forum? - You should know this). But I’m not willing to do someone’s school assignment for them. There’s a difference in my mind, that’s all.