Search Unity

EZ GUI - Powerful, Low draw call GUI solution

Discussion in 'iOS and tvOS' started by Brady, Jun 3, 2010.

  1. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I can't find StartTransition in the scripting reference, and it gives an error if I use it (with myPanel = my panel's GameObject).
     
  2. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    This is because you haven't set your Unity iPhone project to use .NET 2.1. This is mentioned in the "Getting Started" section of the docs which explains in detail the steps to set this setting.

    You could certainly do it with a disabled button. Or you could add a texture to an unused state of a control (such as the disabled state on a control you'll never disable), which will add that graphic to the atlas, then you set the SimpleSprite's material to the same as the rest of your sprites and just tell it where on the atlas to look. Though if the atlas changes in such a case, you'd need to re-enter the coordinates. The absolute easiest and most efficient way is if you have SM2 as well, just use an SM2 sprite that shares the same material with your controls.

    Use a TextMesh. One should normally be automatically added to any control just by typing text into the "Text" field in the inspector (be sure to have a default font assigned in the UIManager first). If for some reason it isn't, you can just add a child GameObject to the control with a "3D Text" component (click GameObject->Create Other->3D Text). Then size and move it to fit how you want it to look relative to your control.

    This is probably because somehow the shader you were using for the sprite had gotten its "Main Color" setting set to 255,255,255,255 (full white). This will result in "over-bright" sprites. By default, the Main Color of the shader included with EZ GUI and SM2 is set to 128,128,128,255 (opaque gray). This results in proper coloring/brightness. Just set this value back to its default and your sprite color back to default (white) and it should look fine.

    @stuartjeff
    Thanks very much for the kind comments! I'm glad you're enjoying it.

    @spg
    Yes, I'll put download links to the actual video files sometime today. Check the page shortly and you should find them. Thanks!

    Sorry about the omission in the scripting reference. I've corrected that and it will appear in the next release. The StartTransition method is defined as:
    Code (csharp):
    1.  
    2. void StartTransition(UIPanelManager.SHOW_MODE mode)
    So you call it with a UIPanelManager.SHOW_MODE enum, such as "BringInForward" like so:
    Code (csharp):
    1.  
    2. myPanel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);
    3.  
    This will play the panel's "Bring In Forward" transition. The reason you are getting the error is that, for instance, "myPanel" in the example above must be a reference to the UIPanel script itself. GameObject does not contain a "StartTransition()" method. So you should either change your reference to the panel's GameObject to type UIPanel (or UIPanelBase), or get a separate reference of this type like so:
    Code (csharp):
    1.  
    2. UIPanel myPanel = panelGameObject.GetComponent("UIPanel");
    3.  
    Just remember that GameObject references only support calling those methods, etc, which are part of the GameObject class as described in the Unity docs. For functionality of a component attached to a GameObject, you must use a reference to that component itself.
     
  3. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    How do you disable a slider control? Setting its controlIsEnabled to false doesn't do anything, it continues to function, and there are no graphics for a disabled state.
     
  4. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    That doesn't work. I start with the iPad in landscape and the controls are sized correctly. But when it's rotated, the controls are now too big. I tried changing the orthographicSize of the camera when rotated to match the current screen height, but then the controls are too small.

    Solution: I discovered that setting the orthographicSize of the camera to one half the screen height when the iPad is rotated fixes the size problem. Which is what I had the camera set to originally. I was thinking I had set it to the screen height, not half. Trying to figure out too many things at once.
     
  5. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    John B:

    Just a guess while on my phone. I can't confirm any of this.
    How do you have pixel perfect set? I can't remember which setting does what, but one setting will preserve the pixel size and the other will preserve the size in relation to the screen (and if I remember correctly, in Unity that means the vertical height so changing he orientAtion could change the exact size if Unity thinks the camera size has changed.). Try setting the size of the icon manually (and there is a "size icon" menu item) and try pixel perfect and see which one works.
     
  6. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    The slider itself does not currently have separate disabled graphics, but the knob does. But if it is still functioning after having been disabled, that would be a bug. I'll fix this in the next release, and also see about adding separate disabled appearances for the slider and background.

    Yes, to preserve the same pixel-to-world coordinate space ratio, you need to change your orthographic size to match the new screen height. On the other hand, if you don't care about preserving the relationship and just want your controls to appear pixel-perfect at the new ratio, you can just call SetCamera() on each control after the camera/orientation changes to make them update themselves with the new ratio. But it's probably just best to preserve the coordinate space relationship so your internal logic that moves stuff around doesn't have to change.
     
  7. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    In the Control Editor, the only knob states available are Knob Normal, Knob Over, and Knob Active.
     
  8. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Ahh yes, you're right. The knob does support it (as it derives from UIButton), but I hadn't exposed this in the editor. I'll make a note of that. Thanks.
     
  9. jmcclure

    jmcclure

    Joined:
    May 5, 2009
    Posts:
    48
    Hi Brady,

    First of all, thanks for your efforts in creating such a great piece of middleware. It is a real time and performance saver.

    I've browsed the docs (and the 8 pages here in the forum) looking for an answer to a question, but have come up empty so far. Is it possible to specify pixel coordinates from a pre-defined atlas to define GUI Control states? I've noticed the SimpleSprite has the ability to index into an atlas, but none of the GUI Controls seem to support it. They actually seem incompatible with the technique of specifying pixel coordinates for control states since atlases have to be regenerated from time to time and your coordinates will likely move.

    I understand the workflow from the tutorials/docs, where individual textures are used to define each control state, but I already have a large, complete GUI atlas with numerous controls and states. I would rather not break them all out into individual controls just to have them rebuilt into a different (but practically identical) atlas. It is also impractical to manage so many individual binary files in SVN (which doesn't handle binary file versioning gracefully).

    Thanks for your time and your fantastic GUI system.
     
  10. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    At the moment, the controls only support automatic atlas generation. I'll have to think about it to be sure, but I think it might be possible for you to do some very simple source changes to make it support the other, but I'm not sure off the top of my head. Let me think about it for a bit and I'll get back to you.

    What you can do, however, perhaps more easily, is disregard the textures for the controls themselves, and instead use "layers" made up of SimpleSprites which portray each control's state.

    Just know that since the control itself's size will be 0,0 since it doesn't contain anything itself, that the automatically-generated collider will be sized accordingly. So the easiest fix for that is either manually set the width/height of the control, or else add a collider to it that is the size you want.

    I hope that helps.
     
  11. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Setting Delegates...

    I've read thru the doc's, and they sound interesting and powerful, and I don't completely understand how I'm supposed to use them.

    I get the script method to invoke, but Brady wouldn't have created delegates unless there was a reason.

    Has anyone gotten this to work that would give a quick primer or pointer?
     
  12. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Transform vs. Offset:

    Brady, what was your intent with these? As an icon can be positioned on the screen using either, I was curious about your assumed workflow. Were you intending that the user place the object on screen using Transform? Or leave the transform at origin and use Offset? Not that I think it makes a difference, I was wondering what your opinion was.
     
  13. jmcclure

    jmcclure

    Joined:
    May 5, 2009
    Posts:
    48
    Thanks for the reply, Brady.

    I'm hesitant to make my own code changes and then have to worry about merging any future updates you might make.

    Would you consider having optional pixel coordinates/static atlases in a future release? I recognize the value in the current workflow, it just doesn't fit mine very well.

    I'll probably end up tweaking the source anyway, as EZ GUI is (by far) the most complete GUI system out there and I'd rather not go back to rolling my own.

    Thanks again,
    Jon
     
  14. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,048
    Hi I am looking for suggestions on how to implement a scroll list that would look similar to a standard scroll list. Where the highlighted entry is the inverse of a unselected entry.

    I am using a text mesh .. my assumption @ this point is that I am going to need to swap the font material and as each item gets selected?

    One thing I have noticed is that if you switch fonts, the material on the mesh renderer is not updated automatically to match the font material? Which would be useful seeing as a font is combo of a material and a texture.

    I was trying to use a Arial Black and a Arial White custom font.
     
  15. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I'm not sure which delegates you're interested in, but I assume you're probably talking about either input delegates or value changed delegates.

    You can see an example of using each in the demo scripts included with the demo project. But basically, delegates give you more information. Invoking just calls a method without any arguments. This means if you want to process information from more than one control, you pretty much have to have a separate method to handle each control.

    If, however, you wanted to centralize all your UI logic in a single method, or want more information about what's going on with your controls, you can use one of the above mentioned type of delegates.

    A value changed delegate gets called whenever the value of a control changes. So for example, you want to know whenever the value of your slider changes. So you register a value changed delegate. This is a method/function you define which will get called by the control, and which receives a reference to the control (as a IUIObject reference, which you can cast to the type of control it is). Since this type of delegate gets handed a reference to the control, you can then easily just use this reference to check the control's value.

    An input delegate is there for people who really want to tweak the behavior of their controls. An input delegate is, at the moment, only available to C# as it requires the ability to receive a reference to a POINTER_INFO struct, and JS, as far as I can tell, does not have a way to pass a value type by reference. The reference is important because it allows you to modify values in the POINTER_INFO variable to intercept it and force a control to do exactly as you want. Basically, it lets your code "eavesdrop" on the control in question, listening to all of its input events, and you can then modify those as desired. So for example if you don't want the control to ever receive a "DRAG" event, you can check for that in your input delegate and change the event to NO_CHANGE. Most of the time, however, you'll never need to use this. But it's there if you want total control.

    You're generally intended to move your sprites/controls about using the transform. So for instance, if you want to rotate your character, you'd just rotate the transform. However, offset can be handy if, for example, you don't want the character rotating about its center. If you offset it from the center, then rotate it, it will appear orbit a point that is off-center.

    There are other such cases where offsets can come in handy, but most of the time you won't need to use them.

    I'll certainly consider it. But check in to the layers method as that might be an easier solution for you than modifying code.

    You can do that, or you could have two text meshes: one for "selected" and one for "normal", and hide/disable the one not in use. See some of the previous posts where this is discussed in a bit more detail.

    Yes, Unity's TextMesh/3D Text doesn't automatically update when you switch materials. You also have to switch the font. I'm investigating writing EZ GUI's own text system which will be much more powerful than the current TextMesh, and will allow changing colors, etc, without breaking batching, using multiple meshes, or anything like that. It will also support clipping/truncating so that there will no longer be a need for "borders" around your scroll lists, etc, to conceal the text before it is disabled.

    So I have a question if anyone can help me out: do you know of any cross-platform (PC Mac) bitmapped font texture builders? I need a solution that will create a font atlas, like Unity does, and will somehow output the font information to a data file of some kind where the UVs of the letters, as well as kerning, etc, info is stored. And Unicode support would be great too. So if you know of anything like that, let me know. I think I have a lead in that direction, but if someone knows of a ready-made solution already, no sense in re-inventing the wheel.
     
  16. jmcclure

    jmcclure

    Joined:
    May 5, 2009
    Posts:
    48
    How solid is the cross-platform requirement? I use AngelCode's BMFont for my projects. It's free, and it fits all your requirements except that it is windows only. It's also pretty widely used in the game industry. Obviously, the generated files will work on any system.

    There's only one cross-platform tool that I'm aware of that's supports kerning (I think), but I can't vouch for it since I've never used it and it doesn't appear to have any documentation. It's called Hiero (that's a direct download link - it doesn't have a project page) and it's a tool for the Slick Java game engine. Hiero seemed a bit unstable when I messed with it, but it might fit the bill. It is also open source.
     
  17. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Thanks, I'll check these out. The cross-platform requirement is pretty important since each developer needs to be able to use it to generate their font atlas from whatever font they may want to use. If something is Windows-only, then Mac devs won't be able to generate their font textures.
     
  18. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,048
    Brady, your plans for text would be very much appreciated as I don't think I will get what I want with the current support. (dynamic list text entries using text meshes and clipping)

    btw .. is it possible to make a sprite see through as in a picture frame or doughnut hole?

    My frame (file type PNG) for my scroll list has no colour in the middle assigned but that section always shows as white?

    I noticed you built your example frame from 4 sprites ...

    iByte
     
  19. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    I used 4 sprites since it is more efficient, texture space/memory wise. But if you want to use a single sprite, you certainly can. If the background is white and it is supposed to be transparent, and you're positive that the alpha is set correctly in the source image, then the problem is probably with your shader. Make sure you're using a blended shader, like the one that comes with EZ GUI. Just be aware that doing it that way will waste a bunch of texture memory as well as fillrate (as the transparent pixels are still being blended with the scene). But once the new text system is in place, you won't need frames (unless you just want them for aesthetic reasons).
     
  20. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,048
    Thanks what you said makes perfect sense.

    On another topic ... I apologize if it's already obvious but is there a method to reactivate the entire list?

    void ClearList (bool destroy)
    Empties the contents of the list entirely. Destroys the items if instructed, otherwise it just deactivates them.

    iByte
     
  21. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    No, because when they are deactivated as a result of ClearList(), they are removed from the list so the list no longer refers to them (and they are de-activated in the sense that their gameObject's .active property is set to false).

    You could save references to them in an array or something before/when you add them to the list, and then you can re-activate and add them back. But when the list is cleared, the items are no longer part of the list.
     
  22. TMK

    TMK

    Joined:
    Mar 29, 2010
    Posts:
    91
    EZ GUI is awesome! Great job, Brady! I'm using all your stuff, and saved a lot of time using them :)
     
  23. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    It looks like each slider control generates its own draw call (maybe more). I'm not sure exactly how many because the number changes each time I run the program. Is this correct?

    Maybe I'm not looking in the right place. I show the Stats panel while running, and compare Emulated Draw Calls when controls are on screen versus when they are off screen. It always shows 15 draw calls with no controls on screen. When I show a panel with 7 sliders and a background sprite, the draw calls value jumps to a number between 23 and 26. I know the background sprite is responsible for one draw call, but does that mean that each slider is responsible for one of its own?

    And when I show another panel with just some toggle buttons and a background, the number goes from 15 to 20-22. Shouldn't all controls just add 1 draw call total? Assuming they all use the same atlas, which they do.
     
  24. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Yes, they should all be one draw call. The editor draw calls number may go up, but the "emulated draw calls" number shouldn't. There is one exception: if you have objects that use another material interleaved between your sprites or in the same plane as them, then automatic batching will split objects which are somewhat behind others from the ones which are in front, resulting in multiple draw calls.

    See the troubleshooting section about this as it goes into great detail about what can cause this and suggestions for fixing it.

    But nothing about sliders, etc, should cause additional draw calls.
     
  25. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Using Pixel Coordinates

    I'd like to say that I would be interested in this as well. I have no trouble building my own atlases if I need to (especially for buttons/icons) and this would mean that I'd only have to pass a Rect around as simple data and it would be great!
     
  26. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Just curious - to be absolutely clear - which of these two possibilities you think is best for turning buttons and items on and off?

    I'm working on a reusable scroll list full of buttons to show a loot list. My current approach is to create a set of buttons equal to or greater than the number I'd ever need to use, then turn them all off. Later, when I open the list, I'll turn on just the number of buttons I'll need from that set, each representing an item. When the use clicks on the button, it will transfer the item and disable itself.

    Is either one of these (button.Hide(true); or button.gameObject.active = false; preferable over the other if I'm going to be regularly revisiting them? (... keeping in mind that I'm most interested in performance on the iPhone.)
     
  27. Kawe

    Kawe

    Joined:
    Dec 3, 2009
    Posts:
    132
    Just bought this. Watched all the tutorials and it seems pretty cool. I'm kind of missing better support for text though. With the normal GUIText I can change the material/shader to a more custom text. However it doesn't seem to be possible with EZGUI... or at least I can't figure out how to.

    Our games have dialogues and it'd be nice to have the text look a little better.

    I think I saw something earlier mentioning that you might add better text support. Please do! :)

    EDIT: Also the text seems to get cut off by a pixel or two.

    EDIT#2: Right, just read some more in the thread and apparently ppl have been requesting better text support. Hope it gets added in :)

    Would be really neat if you could make it so ppl can create their own images and map them to characters. That way you could do all sorts of cool stuff. A little bit tedious to map but definitely worth it since you can choose exactly what characters you want or dont want... and you could translate it to other languages like Chinese without having to add a bajillion symbols you're not gonna use. Heh.
     
  28. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Now that I'm back at my desk - Trying to understand delegates...

    I've been looking at Demo_JS.js, and I can see what you are doing. I'd even say that I understand it to a degree...

    Is the only information being passed to the delegate function a reference to the button object (obj : IUIObject)?

    I see that you set the type with:

    Code (csharp):
    1.     var btn : UIRadioBtn = obj;
    2.  
    3.     var btn : UIStateToggleBtn = obj;
    ...but I only see IUIObject being passed. Or can you pass more information through to the delegate function? Or is it all info from the button itself (btn.StateNum, btn.transform, etc)?

    Trying to answer my own question, is the only custom variable to pass data in the "btn.data" system object? I see that you set it in line 24:

    Code (csharp):
    1. li.data = (i+1) * 10;
    ... and you use it for the particle count on line 89.

    Is btn.data only available in a UIListItem? I only see .data in associated with UIListItem and EZAnimation...

    Ok... enough with the fiddly questions!
     
  29. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    When you set a UIScrollList to active = true, does it turn on ALL of the list items by default? I'm trying to have an item list with (for example's sake) 10 items, and when I activate the scroll list, define how many of the items turn on - some number from 1-10. Currently it seems to turn on ALL of the items. I could iterate thru the items once the list is turned on and turn them off... but I'm just checking if I'm using scroll lists correctly.
     
  30. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Say I have a door (much like the door in the Demo video), animated in 3dMax, it has 3 clips (Rest, Open, Close). You mentioned being able to tie those to a EZGUI control to a 'keypad mesh' and then dragging a script onto the door?

    Can someone explain briefly? The Tut vids deal with menu animation, not imported animation.

    thanks,
    B.
     
  31. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Actually, if you're wanting to "disable" the button, in the sense of showing a disabled appearance, you would use:

    item.controlIsEnabled = false;

    If you are wanting to actually remove the item from the list, use:

    list.RemoveItem(item, false);

    This will actually remove the item from the list (so it can be properly re-sorted, etc), and the "false" tells it not to destroy the item but rather it just deactivates it (sets its GameObject's .active property to false). (NOTE: The next beta will deactivate it recursively.) You can keep a reference to this item incase you need to add it back to the list.

    Actually, you can use any font you want. EZ GUI currently just uses the 3D Text (TextMesh) component built in to Unity. This allows you to use any font you lik.e However, I am currently working on implementing a custom text solution that will be more flexible and will integrate more seamlessly into EZ GUI. Stay tuned as this is definitely coming.

    Yes. UIButton (and all other EZ GUI control classes) implement the IUIObject interface, so what you are receiving is a reference to the control. You just need to assign it to a variable of the proper type to work with it.

    The .data property is only in UIListItem and UIListButton, and it is used to associate information with the given list item. You can assign pretty much anything to it as it is of type "object", so it can hold a reference to anything. In the demo, it is used to hold the number of particles that should be emitted. In another game, it could be something like a reference to the inventory item associated with the list item, etc.

    Yes. I think what you need to do in your case, however, is not activate/de-activate items in the list, but rather, remove/add them. As long as an item is added to a list, it is assumed to be intended to be drawn. If you don't want it there at all, it must be removed.

    Actually, the keypad animation was done using the transition editor. The hangar door rising as a result of using the keypad was done using a line of code in the keypad script. This line calls AnimatePosition.Do() (see the EZ GUI scripting reference for details on using this method).

    But for pre-modeled animations, this was used for the knife switch in the observation hangar that opens the hatch overlooking the planet. You can trigger such an animation using the AnimClip transition element type. Just enter the name of the animation you want to play (see the Transitions section of the docs for more info on the AnimClip type). This assumes, of course, that the object with the EZ GUI component attached also has the specified animation attached. You can trigger animations on other objects in-code as well by using the RunAnimClip.Do() method (see the scripting reference for more details). However, if you do this, you are usually just as well off using Unity's own animation playing routines (Blend(), Play(), etc).
     
  32. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    Brady,

    Would really like to work thru the tutorial s with the project file.. can you stick it up on the Goggle Group? You can pull out anything you dont want to share. But watching and doing together really cement the concepts.

    B.
     
  33. zozogame

    zozogame

    Guest

    Joined:
    Jan 2, 2010
    Posts:
    32
    I just purchased EZ GUI. It works well with my game.It look like in this thread is a good place for discussion, so I have a few questions list here.

    1. Is it possible to bind two delegate method to a single UIButton? In my iPhone game, I want the players to press the UIButton to trigger an action, and trigger another action when they release the button.I haven't look through the entire document for the solution. If you can advice if there's other UI controls that can provide this ability that will save me a lot of time.

    2. For UIButton, the RELEASE trigger doesn't work as I expected. When I set the "when to invoke" to "release", it actually require my finger/mouse to click that button, then move a little bit and release to trigger that delegate method. If I just click and release without movement it does't trigger.

    3. Can I use EZ GUI to create dynamic numbers in game? i.e. The game score and hitpoint display.

    Thanks for help
     
  34. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Yes, I am trying to work my way around to cleaning up those projects and making them available. It will eventually happen. At the moment, however, I'm having to prioritize my time, so I'm currently working at implementing an integrated text solution.

    Actually, it sounds like you're wanting to respond to two different sorts of events. You can use an input delegate for this purpose. See the Input Delegate section of the EZ GUI docs. This is to create a delegate that gets notified of when input events occur to a button. So you can "listen" for a press as well as a
    release. Also realize that you can check the "repeat" checkbox on UIButton and it will call your delegate as long as the button is being pressed, incase that helps you in what you want to do.

    Correct. If you click and release within the drag threshold specified in UIManager, then the release is interpreted as a "TAP" event (clicked, then released). If you drag the mouse beyond the drag threshold and then release, it is just considered a "release". This is useful in touchpad situations since it is typical for touchpads to allow you to "cancel" a tap by dragging away from the position you tapped on. This lets your code distinguish between a successful tap and a "canceled" tap (a RELEASE event). So it sounds like what you want is TAP, which is triggered with you let go.

    You can use a 3D Text/TextMesh component to do this currently. However, I am in the process of implementing a text solution integrated into EZ GUI that will allow a lot more flexibility.
     
  35. Kawe

    Kawe

    Joined:
    Dec 3, 2009
    Posts:
    132
    Is it possible to get the TAP to work more like a tap? Right now it seems to cancel as soon as you drag outside the drag threshold. However it'd be nice if you can drag outside and come back in within the same PRESS and still have it register as a TAP.

    Not a biggie... that's just how I expected it to work. Kind of like a mouse click would work.

    Oh, yes. You can swap out the font but not the font material I think?

    Right now using a normal GUIText I can swap out the material. Basically what I do is save out the font texture and change shader on the material. That way I can paint whatever I want inside the letters.

    Custom text solution sounds awesome though. If you need any help or feedback I'd be happy to help you the best I can.

    I assume people who have purchased gets the update for free?

    Oh... and very nice work on this. It is the best GUI middleware solution for Unity.



    EDIT: Oh right, what should I use if I only want decorative graphics? I know there's layers but it uuhh.. makes sense to have something that is only graphics to me.

    EDIT#2: Oh wait, just rewatched that tutorial... I just use a simplesprite
     
  36. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Yes, you can just set the drag threshold really high (like higher than the screen area, making it impossible for it to not be recognized as a tap). However be aware that this can negatively impact touch scrolling lists until the next release which will address this.

    Actually, you can. It is in the Mesh Renderer component in the inspector.

    Yes. Anything but a full version number increment (i.e. 1.x to 2.x) will be free.

    Thanks! :)
     
  37. Kawe

    Kawe

    Joined:
    Dec 3, 2009
    Posts:
    132
    Hey, I have two more questions :)

    1. I'm having some troubles with the transitions.

    The desired action:
    - fade from 0 to FULL after a 2s delay (waiting for something to slide off the screen)

    How I approached it:
    Baically I just set the transition to fade from 0 to FULL after 2s delay. However this makes the button stay at FULL alpha until the 2s has gone and then it starts to fade.

    I tried putting in two Fade elements where one would fade immediately to 0 and then have another wait for 2s and then fade it to FULL. However that didn't help at all.

    Obviously I could put the Panel off screen and then bring it forward and fade after a 2s delay. However it does add some overhead to managing everything.

    Is there a better way to do this?

    2. Is there some way to make two transitions happen at once?

    Basically I wanted to try something more advanced so I was hoping to try to replicated the login transition in League of Legends. Basically what happens in that is that there are two sliding doors that slide in opposite directions AFTER a lock has unlocked itself.

    This can probably be accomplished with 3 panels but I'm not entirely sure on how to trigger all 3 at once.
     
  38. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    If you're wanting the UI item to begin at 0 alpha, then just set the starting color to 0 alpha in the inspector. Or are you wanting it to be clicked, then go fully transparent, and then fade back in?

    Normally, you could do multiple transition elements at once in the manner you attempted. However, FadeSprite is unusual in that only one FadeSprite can be set for a particular object at a time. You can change this if you dig into the FadeSprite class and in its main Start() method (the one with the most parameters and code), you'll find a Stop() call. Just comment out Stop() and you can do multiples like you attempted.

    From your description, I'm not sure what you're wanting to do. You can do multiple transition elements at once on the same control in response to a state change, but it sounds like you might be talking about triggering transitions on multiple objects at once.

    Instead, I would suggest just using the various EZAnimation classes to accomplish the effect in-code. So when a button is clicked, or whatever you're wanting to respond to, you call a method which has a couple of lines of code that perform animation effects on the objects. Look into the various EZAnimation-derived classes in the scripting reference. You'll want to focus on the Do() methods, which are the ones intended to be used from your own code.
     
  39. Kawe

    Kawe

    Joined:
    Dec 3, 2009
    Posts:
    132
    Hey, thanks for the replies.

    Let's see how to explain the door opening thing.

    Basically there are three main things:
    - 2 doors
    - 1 lock on top of the doors

    What is supposed to happen is that the lock rotates around to "unlock" itself and then the two doors slide away in opposite directions.

    The only place Ive found to do animations like this is through the Panels. So Id have to put each object into a panel and then animate them. However a panel change button can only change one panel. So it won't work since I need to activate three.

    I'll take a look at the animation classes you suggested though. Was just hoping I could do it without code :) It's all good though. Just checking out the limitations so I know how long time things will take when I do the real deal.

    Still loving this since it makes GUI editing so much easier!
     
  40. outtoplay

    outtoplay

    Joined:
    Apr 29, 2009
    Posts:
    741
    I too was looking for how to pull off the simple example that Ka mentioned above. The reference doc is pretty sterile,which is fine I guess if you already have a clue about calling and implementing the appropriate method.

    A simple example can go a longlong way. This is where the Penelope tut fell far short. It was designed by coders clearly looking to demonstrate everything including the kitchen sink, all at once. When sometimes oh to turn the faucet is what is needed. There are coders here, and designers surviving the code. Tools like EZ GUI make progress easier for coders, they make progress possible for designers. A simple scene file example would go a long long way to helping.

    There's is a door that slides open when you TAP a button. Or maybe it slides open at a variable rate between 0-1 when you use a slider. That's all a cube door and the sample fire button.

    From this 3 minute example, you could help us designers hold that example up against the reference guide, and dissect it, and extrapolate on it's functions.

    (and all this before any coffee).

    B.
     
  41. Kawe

    Kawe

    Joined:
    Dec 3, 2009
    Posts:
    132
    Right, I'm slowly making my way through the stuff.

    I'll be posting some feedback as I go. After you wrap your head around the basics it isn't too bad. Finally understood the UIProgressBar. Something you may want to add, as an option, that shouldn't be too difficult is how the Filled Layers are truncated.

    Basically you could truncate the highest indexed layer only. That way you can use it as a "Heart" container in a game. I.e. as you take damage you lose the highest indexed layer (a heart).

    At least that's how I expected it to work when I saw I could have multiple Filled Layer. Haha.

    In fact I just thought the Empty state image was just the whole bar and the Filled state image was the filled portion of the bar. So it'd only truncate the filled portion and leave the empty image under.
     
  42. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    The only thing I can suggest, and it needs a little code, would be to call each panel animation from code.

    On page 5 of this thread...
    http://forum.unity3d.com/viewtopic.php?t=53991&postdays=0&postorder=asc&start=60

    ... Brady mentions this:
    You could have 3 panels and and activator of some sort (a button with no texture or have all 3 panels calling the same method to invoke...) and in that method have:

    Code (csharp):
    1. var trap : boolean = false;
    2. function OpenSayzMe () {
    3.   if (!trap) {
    4.     trap = true;
    5.     myLocktPanel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);
    6.  
    7.     yield WaitForSeconds(2);
    8.  
    9.     myLeftPanel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);
    10.     myRightPanel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);
    11.     }
    12. }
    Or whatever...

    Now this is a bodge, but it could get you up and running.
     
  43. Kawe

    Kawe

    Joined:
    Dec 3, 2009
    Posts:
    132
    Hey man, this is just what I was looking for. Now I can do virtually anything with this GUI solution :)

    It'll be a little wonky with some stuff but it's still the best thing out there... assuming there are no hidden performance issues :D

    EDIT: Maybe we need a PanelManagerManager. har har :D
     
  44. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    You could do that with panels, by calling:
    panel.StartTransition(UIPanelManager.SHOW_MODE.BringInForward);

    You can replace BringInForward with whichever transitions you're using. But you can also do this to a non-EZ GUI object using the various EZAnimation-derived classes directly from code. I'm thinking about putting together a special dedicated transition component that is used to do this kind of stuff to non-EZ GUI objects with very little code. But some code will be required for non-interactive objects since there has to be something to "tell" it when to do its thing. There has to be "glue", as it were, to link the "what" with the "when".

    (EDIT: I see LittleAngle has answered this. Thanks, LA! I appreciate the help. Here's your cookie.)

    It's all coming. I'm having to juggle writing an integrated text system among other new features, while doing tutorials etc. at the same time. So it will take just a little time, but be assured that I'm working on getting more examples, etc, out.

    Actually, you can accomplish this using a sprite that is not set as the layer. Just have your "whole" heart graphic ontop/behind the one that gets truncated, and don't set it as a layer and it will always be there.
     
  45. gstalteri

    gstalteri

    Joined:
    Jun 23, 2010
    Posts:
    1
    EZGui is fantastic! Good job, Brady!
    I also use SpriteManager 2 and I saved a lot of time.
    Still some doubts on Scrollable lists and panels.
    I hope to clarify soon also waiting for your new tutorials.

    Giuseppe
     
  46. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Brady,

    There is so much to this package, I keep finding more and more. You've thought through more functionality than I could imagine needing, until I need it!

    I hadn't seen that yet, and you beat me to the punch delivering what I need even before I know I need it!

    And for peeps on the thread, I thought that would be of some value if *you* hadn't come across it yet.
     
  47. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    I just tried using a scroll list, and can't get it to render correctly. The item textures are not getting added to the atlas. The list gets drawn, but it takes textures from various parts of the atlas, none of which are correct. All the other buttons, toggles, and sliders on screen are drawn correctly.

    I'm doing the list just like in the demo. I copied the Scroll list item prefab into my project, and I use the same setup script. Everything appears to be identical to the demo, except for using my textures and appropriate sizes. I saw something about this in the trouble shooting section, but I don't really understand what it means. I've never used prefabs.
     
  48. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,474
    Thanks for the kind comments, all!

    @John B:
    I think the problem is probably that since you are storing your items in prefabs, when you build your atlases, you need to check the "Scan Project Folder" checkbox on the atlas builder wizard. Otherwise, it will only use the sprites in the current scene to build the atlases.

    If you're on iPhone, this means you also need to keep all your other sprites in the scene linked to prefabs as well. However, there's a work-around if you don't want to do it that way: You can drag an instance of your item prefab into the scene, build the atlases without "Scan project folder" checked, then select the item in the scene and click GameObject->Apply changes to Prefab. That will update the prefab with the new UV locations so it is drawing the correct parts of the atlas. Then you can delete the item from the scene.

    Also, and this will be explained in the forth-coming scroll list tutorial, the scroll list also now has easy-to-use arrays that can be used to specify items to be added to the list. So if it works for your particular application, you can set the "Scene Items" array to point to your various items already in the scene and it'll grab them and add them to the list and arrange them automatically when the scene is played. This can help you avoid using prefab items if you prefer.

    And then there's the "Prefab Items" list. You can use this to add a bunch of prefab items to your list without code. If you want a bunch of the same prefab, just different text ontop, you can just fill in the first prefab slot, and then just set the text for the others, leaving the other prefab references themselves empty.
     
  49. John-B

    John-B

    Joined:
    Nov 14, 2009
    Posts:
    1,262
    Thanks. I just learned about prefabs, and now all my controls are prefabs. The scene contains one simple button, several toggles, several sliders, and the list. Now, if I build the atlas with "Only scan project folder" checked, it draws the list correctly and the one simple button in the scene, and nothing else gets added to the atlas. If I uncheck it, it draws all the other controls correctly, but not the list. And when I go back and forth between having the button checked and not checked when building an atlas, some buttons lose their images and I have to reattach them and build again. So I can either have the controls or the list, but not both.
     
  50. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    There is an "anomoly(?)" in the way Unity seems to display objects. (I'm sure Brady can explain more...) where the buttons definitely do not appear correct after rebuilding the atlas unless you hit "play" for a moment. It can be a quick double tap, and back to editing.

    I've seen this in other situations with Unity, especially after reimporting a mesh with new UVs. They don't appear correctly in the Unity editor until Unity has had a chance to "play" them.

    If you are seeing these issues AFTER hitting play, then I'm stumped.