Author Topic: NGUI with MVC pattern, example inside  (Read 2756 times)

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
NGUI with MVC pattern, example inside
« on: October 03, 2014, 04:33:58 AM »
I recently found about this article http://engineering.socialpoint.es/MVC-pattern-unity3d-ui.html where MVC pattern is used to implement UI (in this case NGUI is used).

It seems like an overkill, but it could be good learning example. Take a look and comment if possible is it a good practice?
Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI with MVC pattern, example inside
« Reply #1 on: October 04, 2014, 07:41:16 AM »
I would never use a plain C# object in Unity like that. Every class should belong to some game object, meaning a MonoBehaviour. In Windward I often use these "manager" classes on the root object of a game window (the UIPanel generally). They are basically scripts with some simple functionality and references to all the needed components, such as text labels and buttons I expect people to click. This way everything is set in one place.