Search Unity

Daikon Forge GUI Library

Discussion in 'Assets and Asset Store' started by TakuanDaikon, Aug 6, 2013.

  1. ozoner

    ozoner

    Joined:
    Jun 8, 2009
    Posts:
    85
    Thank you so much for the response. Last night I created new button textures attached them to plains parented the plains with the spheres and by using a cut out shader on the button textures I was able to get a decent looking menu working with the addition of mouse over and color changing along with Leap in a prefab. But I will ( in version 2 ) use your updated frame work. Also have a couple of other projects that are not Leap enabled and I have created two menu systems in less then a day and a half. Again thanks for the quick response.
     
  2. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    With Unity 4.3 being released today, customers using the latest Unity version will notice a bunch of compiler warning due to some editor functions being deprecated:

    I just wanted to mention that, although annoying, these will not cause any problems. The next update (v1.0.11) will resolve all of these.

    Additionally, now that 4.3 has been officially released, we will be working on incorporating as many of the new features as possible and sensible for DFGUI. We will have more information about this on our support forums as this effort progresses.
     
  3. Tee_Pee

    Tee_Pee

    Joined:
    Aug 18, 2013
    Posts:
    54
    Great to hear... This might have been asked already but does DF-GUI have any issues with font sizes on Android?
     
  4. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    None that I'm aware of. Do you mean with using dynamic fonts? If you can provide me with a common test scenario where it's been a particular problem I will test it and let you know for sure.
     
  5. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks. Each item on the list would be a separate .txt file with several float, string, int and color variables in it. I read the contents of a folder at runtime and I'd like to display them in the list using the name variables in the .txt files but I'd also need to reference them once an item is selected.

    The reason I'm loading .txt files is because player can create items in my game and share them by putting them in a folder and they will be automatically read.

    I have this functioning in NGUI by instantiating a prefab per line but I'm making the switch to DF-GUI and your listbox is perfect for this use.
     
  6. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    You can try this demo scene, which loads data from a .csv file into a list of ItemDescription objects, populates the Listbox with the names of the items, and uses the Listbox's SelectedIndexChanged event to synchronize the selected item with other GUI elements.
     
  7. Tee_Pee

    Tee_Pee

    Joined:
    Aug 18, 2013
    Posts:
    54
    Hey, not sure if I'm just being stupid or if this is a bug... I want a progress bar that's always on the bottom of the screen and takes up the whole width regardless of resolution. I am having trouble getting there though... doesn't seem to be an issue with labels, but the progress bar just won't listen. When I turn off pixel perfect it works flawlessly for the resolution I build it for... but with pixel perfect it's scaled like 10 times the size it shows up in the UI root grid.


    EDIT: Nevermind, I figured out how anchors work.
     
    Last edited: Nov 13, 2013
  8. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    Do you have the progress bar's Anchors set to dock to the bottom, left, and right? With Pixel Perfect off, it scales the entire UI, but doesn't always look good at resolutions other than the design-time target resolution. With Pixel Perfect on, your control does not automatically scale, and must be anchored:

     
  9. Tee_Pee

    Tee_Pee

    Joined:
    Aug 18, 2013
    Posts:
    54
    Your reply was faster than my edit, thanks a lot, I figured it out. Now just to figure out how to actually set the value from code and I'm golden :D

    So far I am really liking this, it'll make my UI creation a breeze once I have a handle on all of it.
     
  10. Tee_Pee

    Tee_Pee

    Joined:
    Aug 18, 2013
    Posts:
    54
    Back with more noob questions... I've set up the progress bar, its value is set properly, all is well... except the GUI now seems to be eating my touches and clicks on the elements below, as the elements below don't seem to be firing off their OnMouseDown events...
     
  11. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    Can you clarify what you mean by "the elements below"?

    Also, did you know that we have a dedicated support forum? That is often the best and fastest way to get help on questions, as well as report any bugs, etc.
     
  12. Tee_Pee

    Tee_Pee

    Joined:
    Aug 18, 2013
    Posts:
    54
    Sorry if I wasn't clear... I meant that there are gameobjects on the scene that have OnMouseDown events... those aren't fired now that I have a DFGUI on the screen.
     
  13. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    Those should still be firing, as long as the gameobjects are on a different layer than your GUI. DF-GUI disables the built-in OnMouseXXX events for GUI elements because it is far too limited and conflicts with library functionality.

    If your game objects are on a different layer and you're still experiencing this issue, then take a look at dfGUIManager.Start() and comment out the following section of code to see if that helps.

    Code (csharp):
    1. var sceneCameras = FindObjectsOfType( typeof( Camera ) ) as Camera[];
    2. for( int i = 0; i < sceneCameras.Length; i++ )
    3. {
    4.  
    5.     // Get rid of Unity's extremely annoying tendency to throw errors
    6.     // about being unable to call SendMouseEventXXX because the event
    7.     // signatures don't match. Whose idea was that, anyways? Sheesh.
    8.     sceneCameras[ i ].eventMask = ~( 1 << gameObject.layer );
    9.  
    10. }
    11.  
     
  14. Tee_Pee

    Tee_Pee

    Joined:
    Aug 18, 2013
    Posts:
    54
    I have figured out the issue... for some reason my game camera had the dfGUICamera script attached to it... I was experimenting with stuff and assigned to GUI to render on that camera.... I'll stop with the idiotic questions now as to not further embarrass myself :p Thanks for help!
     
  15. sandboxgod

    sandboxgod

    Joined:
    Sep 27, 2013
    Posts:
    366
    Is Daikon Forge coded using .NET 4.0? I included it into my project and ever since I keep having to change methods to not use default parameters. By default, Monodevelop is set to .NET 3.5 which does not allow defaults. Changing it to .NET 4.0 will fix the compile errors until Unity decides to reset it back to .NET 3.5 when I close/run it again.

    What gives? Perhaps the authors used Visual studio and worked around this restriction somehow?
     
  16. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    I don't think optional parameters are a problem in .NET 3.5, but they seem to be for Monodevelop? Unity itself obviously doesn't have a problem with them.

    I do use Visual Studio for development, here are the settings:



    When I open the same project in Monodevelop, this is what I see:




    [Edit]
    Ah... This appears to be a well-known problem with MonoDevelop. MonoDevelop 4, which was included with Unity 4.3, does not appear to have this issue.
     
    Last edited: Nov 14, 2013
  17. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    Just wanted to remind anyone who's still considering Daikon Forge GUI that the Birthday Bonanza sale has less than 24 hours left to go.

     
  18. sandboxgod

    sandboxgod

    Joined:
    Sep 27, 2013
    Posts:
    366
    So you don't have any issues in MonoDevelop 4? Hm, I guess something got messed up for me. I've been using Unity 4.3 with Monodevelop.

    Hm, I might just switch to Visual Studio at some point. I prefer VStudio just a tad bit more then Mono. Thanks!
     
  19. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    To be perfectly honest, I really hate Monodevelop and use it as little as possible. I've been using Visual Studio for forever, and really prefer it.

    I did try to rebuild the project in Monodevelop 4 and didn't get any errors or compiler warnings and everything appeared to be pretty normal, but I didn't do any exhaustive testing.
     
  20. ozoner

    ozoner

    Joined:
    Jun 8, 2009
    Posts:
    85
    Can I use Glyph Designer to generate my font textures?
     
  21. sandboxgod

    sandboxgod

    Joined:
    Sep 27, 2013
    Posts:
    366
    Thanks a lot you were a great help! Btw this is a great product. I've mocked up a prototype HUD for my game really fast using the examples.
     
  22. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    Yup, sure can.

     
  23. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    I'm an idiot: can I put an if statement into the expression property binding? I don't have much JS experience but googling around valid ways to do it doesn't seem to work.
     
  24. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    The expression language isn't exactly Javascript, it's something I made up with many similarities to Javascript and C#. You could just as easily (and perhaps more accurately) consider it limited C#. The most important thing to remember is that it must evaluate to a value.

    This page is a great reference for most of what you can use, with some exceptions:
    • Exact equality/inequality ( === and !==) operators are not supported
    • Assignment operators are not supported ( =, +=, -=, etc )
    • The comma operator is not supported
    • Statements, including if statements, are not supported
    Having said all of that, the conditional operator is supported, which operates like an inline if statement and might be useful in your situation.

    For example, you can use it to choose between two options: 1 > 2 ? "True" : "False"

    You have access to a source variable that corresponds to the Data Source field you see in the inspector. So for instance if you'd assigned a Listbox control to the Data Source field, you could use an expression like the following to return the text of the listbox's selected item:
    Code (csharp):
    1. source.Items[ source.SelectedItem ]
    or if you want to be fancier, you could use
    Code (csharp):
    1. source.SelectedItem == -1 ? "Nothing Selected" : source.Items[ source.SelectedItem ]
    Additionally, you have access to the following types:

    • int, float, string, bool,
    • UnityEngine.Application
    • UnityEngine.Color
    • UnityEngine.Color32
    • UnityEngine.Random
    • UnityEngine.Time
    • UnityEngine.ScriptableObject
    • UnityEngine.Mathf
    • Vector2, Vector3, Vector4, Quaternion, Matrix4x4

    With these types, you can call any static method defined on the type, like:
    Code (csharp):
    1. string.Format( "Selected Index: {0}", source.SelectedIndex )
    or
    Code (csharp):
    1. Time.realTimeSinceStartup.ToString()
    or
    Code (csharp):
    1. int.Parse( source.Text )
    I hope this explains things better. Please ask if you'd like more information.
     
    Last edited: Nov 15, 2013
  25. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    Thanks that is really helpful. I guess that explains why my JS wasn't working. I know you guys have a lot of work queued up but a written reference doc on the site for the expression language would be awesome.

    Also, can you use the conditional operator to check for null?
     
    Last edited: Nov 15, 2013
  26. Brainswitch

    Brainswitch

    Joined:
    Apr 24, 2013
    Posts:
    270
    The restriction is entirely in MonoDevelop, Unity supports defaults (Unity is not running any exact .NET version, but their own custom version of mono) and have done for quite some time.
     
  27. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    The conditional operator can check for null, yes. The conditional operator looks a little arcane, but is very powerful since it can have any expression in its condition, value1, and value parts.

    You could use something like this, for instance (just to show ExpressionBinding's ability to handle complex expressions) :
    Code (csharp):
    1. (source.Player != null) ? string.Format( "Health: {0}", source.Player.Health ) : string.Format( "Respawn in {0}", Mathf.FloorToInt( source.TimeTillSpawn ).ToString() )
     
    Last edited: Nov 15, 2013
  28. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Hi Daikon,

    I've been thinking about conditional expressions on IOS.

    There is a package that parses text and does a type of ExpressionBinding that works on IOS.
    It's called UDE Dialogue Engine and uses CML (open source), perhaps you could use the ideas for Daikon so that ExpressionBindings can work on IOS.

    Cheers.
     
  29. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    The biggest barrier to iOS is that the expression binding engine is a compiler, and uses dynamic code generation to achieve an execution speed on par with C#. I basically already had the code around since I build compilers for fun on occasion, so I was able to re-use a subset of the original project in DFGUI easily.

    In order to run on the iOS, which doesn't support dynamic code generation, I'd have to compile to bytecode and have a small interpreter/VM that was responsible for executing the bytecode. That is certainly doable, and could even be relatively performant considering the runtime requirements (think Lua performance rather than C# performance), but it's definitely not a trivial task :D

    I'll almost certainly add this at some point, but it's hard to guess when I'll be able to do so.
     
  30. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    A small compiler for expression binding. That sounds cool.. but probably quite a bit of work.
    UDE does it without the compiler using CML. CML is able to parse text into objects.
     
  31. Vidd

    Vidd

    Joined:
    Jun 3, 2013
    Posts:
    7
    Should have asked this earlier, but does this play nice with the 2D Toolkit or does it run into problems?
     
  32. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    Not sure quite what you are asking. I have both of them working in the same scene with no problems, but I haven't done extensive testing.
     
  33. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,664
    I've send you an PM :)
     
  34. sandboxgod

    sandboxgod

    Joined:
    Sep 27, 2013
    Posts:
    366
    Thanks guys! I understand now! I've switch to using Visual Studio now so I don't have that issue anymore.

    Just added Enemy Health bars this weekend which was really straight forward.Just had to learn the difference between relative local positioning of the controls

    I like how the API is setup where everything derives from dfControl. This system is a huge time saver and really easy to use
     
  35. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    I've used many dev environments in the last twenty years, and there are some pretty good ones out there, but the best one for me has always been Visual Studio. I'd even take the free Visual Studio Express over many of the IDE's I've been forced to deal with. I really believe that you'll end up preferring it as well.

    I'm glad that you are making good progress and finding DFGUI easy to use, that was exactly what we'd hoped would happen :D
     
  36. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    When I try to use that kind of code to check for null such as
    Code (csharp):
    1. (source.SelectedItem != null) ? source.SelectedItem.BaseItem.Icon : ""
    I get errors saying it can't convert from System.Object to InventoryItemStatus (or whatever the source type is).

    If I do it with something that is a standard Unity variable (e.g. check if a string is null) I get this error:
    "System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object"

    Obviously it is easy enough to handle this with some glue code (pass an empty string if null, etc) but it would be a nice feature if I could get it to handle itself purely in the expression binding.
     
  37. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    I wouldn't have expected that to happen. If you could somehow send me (support email is listed on the Asset Store listing) a small repro project that demonstrates this I will see what I can do about making this work purely with expression binding.
     
  38. Thavron

    Thavron

    Joined:
    Aug 29, 2012
    Posts:
    364
    Looks very powerful. I will take a closer look at DF-GUI as soon as I have to create my next GUI.
    Thanks for providing the free version.
     
  39. Deleted User

    Deleted User

    Guest

    Does DFGui support alpha mask clipping? (non rectangular panels)
     
  40. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    Currently it does not. We are considering adding that in the near future.
     
  41. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    +1 "alpha mask clipping"
     
  42. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    I just bought this and I can't seem to find the basic tutorials to make Controls do things. Mak a Checkbox or button trigger something in Javascript and in C#. Any links I can learn the basics on??
     
  43. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    I see you've made a thread on our support forums, we'll respond to you on your thread there.
     
  44. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    One of the most-requested features has been to allow the use of TrueType fonts in Daikon Forge GUI. Yesterday's update now allows the use of TTF/OTF fonts in any control which renders text:

     
  45. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    Another TRULY AWESOME FEATURE...

    Well Done Daikon.
     
  46. dreamlarp

    dreamlarp

    Joined:
    Apr 22, 2011
    Posts:
    854
    :D I am so glad I got this asset. Thank you for this last update.
     
  47. Deleted User

    Deleted User

    Guest

    I can't scroll in the Daikon Forge Web Player examples on my mac. OSX 10.8.5 - Safari
     
  48. MaryInvents34

    MaryInvents34

    Joined:
    Aug 28, 2013
    Posts:
    15
    Hi TakuanDaikon,

    I've purchased your GUI library - it's a great product. I have one question though: The listbox only supports text, where as I would like to draw a list of images, or some complex row template. How is this possible with DF GUI?

    Thanks.
     
  49. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    Currently that cannot be achieved with the Listbox control. We're considering adding this as a built-in component, but in the meantime it should be possible to create your own implementation by extrapolating from the Achievements screen in the Game Menu example. Essentially, a "template" row is added to the grid that defines the UI for a single row, and a managing component takes the list of data items and for each one instantiates an instance of that template row and binds the data to the row's ui widgets before adding it to the scroll panel.
     
  50. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,462
    +1 Would be very nice to have a built-in list box that supports more than text.