Search Unity

XmlGui now in the Asset Store

Discussion in 'Assets and Asset Store' started by menneske, Jul 20, 2012.

  1. menneske

    menneske

    Joined:
    Jan 23, 2009
    Posts:
    44

    We're proud to annonce our first contribution to the Asset Store: XmlGui

    XmlGui puts your designer in control of the GUI, not your coder.
    With HTML and CSS-like syntax it's a breeze to learn.


    Spend time implementing fancy features, not treading the endless hierarchies of calls to GUILayout.
    Need fancy custom features? Hook your custom GUI code right into XmlGui with one simple tag: <custom>


    See XmlGui in action (all Xml and C# required exposed)

    This Xml code gives a centered area on screen
    Code (csharp):
    1. <?xml version="1.0" encoding="utf-8"?>
    2. <xmlgui>
    3.     <skin></skin>
    4.     <gui>
    5.         <area
    6.             guistyle="box"
    7.             style="align: center; valign: middle; width: 640px; height: 480px;">
    8.             <button onclick="ButtonPress">my button</button>
    9.         </area>
    10.     </gui>
    11. </xmlgui>
    12.  
    And this C# is all you need to receive the button press
    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class YourGUI : MonoBehaviour {
    5.     void ButtonPress(XmlGuiObject button)
    6.     {
    7.         // Handle button press action
    8.     }
    9. }
    10.  
    Documentation for the Xml tags and attributes here
    Experiment with it here

     
    Last edited: Jan 4, 2013
  2. kenlem

    kenlem

    Joined:
    Oct 16, 2008
    Posts:
    1,630
    Cool! How is this rendered? Is it using the normal Unity GUI calls underneath?
     
  3. menneske

    menneske

    Joined:
    Jan 23, 2009
    Posts:
    44
    Yes, the Xml is parsed and the elements rendered through normal Unity GUI calls.
    But you get to have full access to all the different elements of the GUI in the editor/through code.

    Saves a lot of code-writing :)
     
  4. bali33

    bali33

    Joined:
    Aug 14, 2011
    Posts:
    232
    Hello,

    One question, how do you trigger the event like "onClick" ? Do you use sendMessage method ?

    Thx
     
  5. menneske

    menneske

    Joined:
    Jan 23, 2009
    Posts:
    44
    Yes, all the messages are sent to the XmlGui object through the built-in SendMessage (onmouseover, onmouseout, onmousedown, onmouseup, onclick, ontoggle, onselect, onchange, etc). So you just add your custom components to the object and get your functions called on the events.

    And most XmlGui tags can have mouse events, even labels and areas.
     
    Last edited: Jul 20, 2012
  6. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,051
    Love this tool.

    Could you explain how the extensions are used, and provide some examples?

    Thanks!
     
  7. menneske

    menneske

    Joined:
    Jan 23, 2009
    Posts:
    44
    Glad to hear it zombiegorilla :)

    Extensions is how to simply modify (or "extend") the default behaviour of the different XmlGui elements.

    I've updated the default package in the asset store with a new example scene, which uses an extension to easily keep track of if the mouse is above a gui element or not.

    Basically its just a way to interact with the XmlGui nodes while they "do their thing". XmlGui has the following Extensions included with the asset store package:

    AreaEntrance
    Uses a curve to control the entrance animation of a XmlGuiArea element

    Bob
    Simple up and down bobbing motion (can target any XmlGui element)

    ShowOnEnable
    Simple, simple simple; just waits a pre-determined amount of seconds then shows the XmlGui node. I've used it mostly to get a little more control of how the gui enters the screen.

    ToggleGroup
    By default toggles in unity are singular. This extension groups toggles so you can have a toggle group where only one can be selected at a time.

    Input
    Added with current update; keeps track of if the mouse is over the gui or not. Also includes functions you can swap with Input.GetMouseButton() to only get true when the mouse is *not* over gui. Example Scene 3 shows this extension in action.

    You can find these extensions (as C# source) in the XmlGui/Extensions folder. The recipe for creating your own is to implement the IXmlGuiExtension interface (see the XmlGuiExtension.cs source for example of how this is done). The interface itself is defined in XmlGuiInteractive.cs, where you can find a few comments on the different methods you need to implement.

    Best of luck!
     
  8. menneske

    menneske

    Joined:
    Jan 23, 2009
    Posts:
    44
    Just a bump to give notice of the changed price, which is now 45$.
     
  9. stu_dious

    stu_dious

    Joined:
    Feb 19, 2013
    Posts:
    32
    Hi, for a project I'm working on I need to display text in a fairly rich text format. XMLGui appears to be a good option but I wonder if you can clarify a few things for me before I purchase the plugin.

    - I'm assuming all xml form creation / text formatting is written in an xml document then imported at runtime ... is that correct?
    - If so, is it possible to have dynamic text elements i.e. the document text can me changed at runtime to present alternative / updated information?
    - Also, just checking that 'windows' displaying text can handle scrolling text blocks larger that the current window size?

    Thanks for any feedback.
     
  10. Kirkja

    Kirkja

    Joined:
    Oct 18, 2009
    Posts:
    7
    I'd like to second the questions asked by stu_dious about dynamic text, and amount of text.
     
  11. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Great plugin, this looks very much like MXML Flex.

    Questions:

    1. Does it include data binding ?
    2. Work with Unity Flash ?
    3. Can we use NGUI ?
     
  12. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Hello, is the author of this plugin still supporting this plugin?
     
  13. Frednaar

    Frednaar

    Joined:
    Apr 18, 2010
    Posts:
    153
  14. SylphWorks

    SylphWorks

    Joined:
    Jul 13, 2011
    Posts:
    8
    Does it support ios / android?

    And is it enable to load resources from AssetBundle?
     
    Last edited: Jun 18, 2013