Search Unity

Decent GUI system: Flex/Silverlight/HTML5 based GUIs

Discussion in 'Works In Progress - Archive' started by ImogenPoot, Aug 13, 2012.

  1. ImogenPoot

    ImogenPoot

    Joined:
    Jul 2, 2012
    Posts:
    214
    Hi,

    this post is about my current progressing work on a decent GUI system (integration). This will be Unity Pro only, since it needs unmanaged plugins. It will work on Windows and Mac and most likely also Linux when Unity 4 comes out. Videos will follow during this week. Estimated completion is maybe two weeks. All major technical challenges are solved already.

    I've gone over two months with NGUI, trying to create a rather complex level editor. Now I think this is going to be a dead end. At some point (see my other posts) this is slowing Unity down as hell, since you just have to many scene nodes and it also comes at quite a noticable runtime cost.

    I always loved the Windows Presentation Foundation! And I always asked myself, what have I done to suffer these crappy GUI systems we have with Unity? NGUI is still the best by far, but honestly it is only bandage around Unity's open wound.

    Today I tried Adobe Flex, thanks to a university project, and I immediately (I hated Flash before so) started liking it. You can easily theme and skin stuff, do data binding and item templating, design everything with a good WYSIWYG editor and have a strong code/design separation. Pretty much like WPF, just not soo sophisticated! So I thought, why not bring this to Unity?!

    The same goes for Silverlight actually, which is kindof a raped WPF, but still pretty decent. The advantage with using Silverlight is that you could easily exchange data between Unity and the GUI through the standardized NET serialization (at least I hope so).

    From my development with NGUI, I have also powerful data-bindings, which allow you to easily connect your GUI to C# code, without writing a single line of code. This would also work with Flex and Silverlight. So you could actually just write a string, denoting to which C# field you want to bind to, and my GUI system would automatically do all the work behind the scene to synchronize your GUI with your code and vice-versa...

    It would be possible to use the powerful tools for Flex and Silverlight do develop your GUI and its design logic (how components interact and stuff) and ultimately attaching this nicely designed GUI to your game data.

    For HTML5/Javascript there will be a lightweight JavaScript-API which allow you to query C# fields in the same way, just that you have to query them manually.

    Besides the data-binding, this is a thin wrapper around the Awesomium-Browser. In theory this one already comes with a Unity plugin, just that I found it to be inherently broken. Unity crashes randomly, and it also does only work with an outdated version, does not display Flash/Silverlight content and so on... It is just very unpolished. My solutionw orks with the latest Awesomium version and can display websites like Youtube and Facebook flawlessly in a Unity texture...

    It does inverse UV mapping to find out where on the website you have clicked. This is pretty decent when you want to use the texture on an arbitrary mesh. So if you click a button on a rabbit's foot, the system will reverse engineer this ray collision to a precise 2D coordinate within the website and just click that button ;).

    Also most actions and events of Awesomium are available in Unity. The code is easy to understand and kept very slim and lightweight. Performance is of course a little problem. Though I can play a fullHD youtube video in a Unity cube with over 30 FPS on my rather slow Intel GMA notebook. So on any decent hardware, this will be no bottleneck! Also if the website doesn't change (is static), the texture is not updated and there won't be any overhead at all...

    So I'd like to know how you think about this, and maybe also if you would pay something for this. As always, publishing an asset like this can be quite time-consuming and since all potential customers need to have Unity Pro anyway I would set the price somewhere around 50-100 EUR (like existing GUI systems)... With all source code included of course.

    Unity 4 is not really a hope for me, since from what I saw it is more a HUD GUI. So creating decent level editors or even configuration dialog is still going to be a pain in the ass. Additionally, I highly doubt that Unity has the resource to put in so much effort for getting a GUI system comparable to what Flex and Silverlight have to offer... Microsoft put one billion dollars into WPF alone ^^.

    Awesomium is free just like Unity, as long as you don't make more than 100k revenue.
    If you do, there is a one-time fee of about 3000 EUR.
     
    Last edited: Aug 13, 2012
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    The main things I want from a gui system is a) it's fast/efficient/optimized without me having to do anything to achieve that, and b) I create the gui entirely in a WYSIWYG editor without having to get into scripts or dragging scripts onto objects or calling API's or whatever. NUI is not that.
     
  3. ImogenPoot

    ImogenPoot

    Joined:
    Jul 2, 2012
    Posts:
    214
    Yes I know that ^^. That's kind of the point I was trying to make... And is what my work in progress will deliver.