Search Unity

MVC on Unity

Discussion in 'General Discussion' started by KlepZ, May 23, 2019.

  1. KlepZ

    KlepZ

    Joined:
    Sep 9, 2017
    Posts:
    5
    Is anyone using MVC pattern to develop games on Unity? Tell me about your experience
     
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    3,632
    Again? Okay, so if you really want to choose, choose MVVM. Usually forget data-binding, unless you are working on a really small thing where the performance does not matter.

    Otherwise don't shy away break any rules you need to deliver the thing you want and on a preformant manner on your choice of target device. And I'm serious.
    And if you want to read long and probably boring debate about these things, just search the forums, we talked about this multiple times.

    Don't forget, games aren't business applications, you need to make them differently.
     
    xVergilx and Ryiah like this.
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    13,910
    We clearly haven't had enough people trying to approach this game engine in ways that it wasn't intended to be used. :p
     
  4. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    602
    I'm not even sure how this would work.
    A MonoBehavior script can be a model, sure, but what's the view and controller?
    A scene being a view and the SceneManager being the controller are the closest things I can think of, but they don't even have any correlation to the model in this context.
     
  5. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    11,789
    You have a full .NET environment at your disposal. If you consider the Unity scene and/or GameObjects to be your "View" then your model and your controllers can be whatever you want to code up. I've seen this approach used to quite some success in the past.

    It certainly doesn't have to be the performance nightmare that people may easily imagine.
     
  6. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    4,298
    Use MVVM for the UIs if you have a game with complex UI. Thats about it.,

    Also if you use the menus in game (Overlay over the main game) make sure the MVVM framework do not allocate etc as it can ruin performance for rest of game.
     
  7. Redtail87

    Redtail87

    Joined:
    Jul 17, 2013
    Posts:
    77