PureMVC C# in Unity 3D

Hi Guys,

Has anyone tried the C# version of PureMVC in Unity 3D?

Cheers,
Vejko

I haven’t tried it but a good question to ask is why would you try and use it with Unity? The two don’t seem to be a very good fit and trying to use PureMVC with Unity would probably require more hacking/workarounds that it’s worth.

I am coming from Flex/Flash background and I am using puremvc in all my projects.

If you have more developers on the same project and everybody knows puremvc rules it is very easy to understand each other’s code and logic.

It makes your code simpler and cleaner and more efficient.

If Unity uses standard c# then probably it could work, but I will spend some time finding out whether these two great stuff can work together.

I’ve used PureMVC for Flex as well and it works well for an application, no doubt about it. The problems with trying to use something like PureMVC in Unity is one of the design of Unity vs Flex/Flash. Unity doesn’t lend itself well for working with external MVC frameworks, at least from my limited working with it. If you get things working and have a good workflow with it I would love to hear about it.

I was trying to visualize how you would implement that. I haven’t looked at the c# version of PureMVC yet but was planning to look at it for the same purpose. I could see how that could be useful for having multiple aspects of the game respond to model changes. D@mn! that’s what I’ll be thinking about in traffic tonight- thnx.

Unity is heavily built around the observer and decorator pattern …

It won’t be easy to get MVC into such a flow especially as you won’t be able to seperate anything cleanly (its all monobehavior, splitting 1 into 3 just to please the MVC insanity would result in far less clean code and additionally be less performant as you get three times as many oberservers)

Interesting, I’m about to look into “observer and decorator” all new to me. I was thinking HMVC for code structure but its just an idea at the moment. I’m in from a pure prototype approach, nasty looking code that needs an arch.

When I use PureMVC in Flash projects I have the View Mediators encapsulate View Components that encapsulate View Objects. View logic lives in the View Components, the View Mediators serve as adaptors to the PureMVC framework. And view framework specific code/technology lives in the View Object. In Flash you have two view technologies, the Display List and Stage3D(Starling). By encapsulating the View Objects and isolating view specific technology in the View Object, I can easily switch between the two technologies (Display List and Stage3D). I would apply the same approach when using Unity. Here is my RootView framework for PureMVC (this is in ActionScript, but you could port it) - Welcome to dorkbots! - Dorkbots PureMVC