@hippo, but of course there is text size support. It's a requirement for the text alignment feature coming in the future I believe the method is sizeForText if I'm not mistaken.
Wow, you must be some kind of mad genius thinking of that too. I only posted half hoping it would be in there. What I must really bother you for is a list of commands and their parameters. That would really speed things up this end Pretty please that you might throw a quick page up?
@hippo, nothing genius about this one unfortunately. I needed to right align some text and that required the width so the method was born!
A very basic (and not complete) API reference is available here: http://prime31.com/unity/docs/#uiToolkitDoc
If you use C# and MonoDevelop you can use code complete to get a full list of available methods. Over time we will fill in the method summaries which MonoDevelop displays in the code complete window. Some stuff is in there but a lot ins't yet.
Hi Prime31 Now I really don't have any excuses for using your GUI system it works perfect on my nexus one (The only scene that did not worked was the joystick)
Thanks again for the great tool!
The joystick demo scene hasn't been given the proper relative positioning support to work on all platforms. It is currently iOS non-retina only but it shows all the tools you need to make it for any platform.
I found some oddities in text alignment on mac unity editor and pc unity editor - but that might just be me. I will investigate further... namely the mac version was whole newline too high. What might cause that do you think?
Thanks for the api docs! I am happy as a pig in muck. It is still quite baffling you did not charge for this
@hippo, I can't imagine there would be a difference between the Mac and Win newline. It comes from the exported fnt config.
There is no charge for UIToolkit so that Unity devs have no excuse why their menus and HUDs are not as polished as their games. Not to mention with the advent of the Asset Store there isn't much sharing going on anymore. Everyone dumps their wares in the AS instead of sharing. Sometimes a freebie is good to get the new users pumped and motivated about using Unity.
Just to be picky - why the lower case method names?
@duke, just to be different than the Microsoft code guidelines mainly Not to get into a discussion about the benefits of different code guidelines or any of that off topicness over the years programming many, many different languages camel case method names and instance variables with capital lettered class names was always more clear but YMMV.
Just updated from the first version to the latest. The process for making buttons relative to the edges is awesome now.
Just one thought though - all the position methods have parameters which are ( y-axis , x-axis ) for their adjustment. It's a bit confusing. Might be better to be x-axis, y-axis ordering like Vector2's. Though you would have to reorder the methods to be positionFromRightTop rather than positionFromTopRight which doesn't sound so natural I guess...
@Tainted, it was a tough call but sounded more natural to have top/bottom first due to the way we speak (English at least).
Yeah fair enough, just one of those situations where you gotta make a call I guess.
Just noticed the UIToggleButton isn't showing it's highlighted state. It's missing the
- this.highlightedUVframe = highlightedUVframe;
from the constructor and the
OnTouchBegan method with.Code:
- highlighted = true
I also started hacking together a discrete slider (one that goes from min to max in increments of 1). As I was doing that I noticed that the UISlider goes from 0 to 1, but the knob doesn't move for small values close to 0 and 1. You've got the position going from:
- float xPos = position.x + normalizedKnobValue * width;
while if you do this:
- float xPos = position.x + (_sliderKnob.height/2) + (normalizedKnobValue * (width - _sliderKnob.height));
basically interpolating between the knob min max rather than the slider's min max, the knob will move for every value. It's not a big issue, just trying to make the awesome code even better
Good finds. I'll be looking forward to your patch or pull request
haha will do once I come out from under my TortoiseSVN shell and learn how to do a GIT pull
There is a tortoiseGit if I'm not mistaken. Works just like the SVN one.
Downloaded Git + Gitti (I'm on a mac atm). Made the changes for the toggle button but now I can't push them as a patch. Argh, I think either Gitti doesn't support patches or I've cloned the repo instead of pulled it. Since the repo is read-only I should be creating a patch which is committed and then accepted on your end right?
@Tainted, so far, you get an A for effort! Well done! Here are the steps to take to pull it off:
- Click the fork button to get your own fork of the repo:
- Make the changes in your local repo and check them in (unlike SVN, checking in with Git doesn't push the changes to the server)
- Push the changes to the Github server
- Make a pull request on the UIToolkit Github page
Once you get used to Git SVN becomes a painful chore to use. Might I recommend the wonderful Gitbox (has a free version) or the number one Git app Tower (paid app)
Edit: I just pushed the fix for the UIToggleButton. I'm not so sure the slider positioning is accurate though. You are taking into account the sliderKnobs height which shouldn't have anything to do with the x-position of the slider knob. The knob is basically just a fraud (just a on the slider. Touching the track is what really matters. Like this: http://markup.io/v/9kpgvd65sz76
Last edited by Prime31; 05-09-2011 at 09:38 PM.
@Prime31 Ahhhhhh. Enlightenment! Ok I've set it all up. I see you've already made the changes to the toggle. I'll be sure to check in any more bugs I find. Cheers
I converted the sample code to JS, and get a nice "SCORE 123" display. But I don't know how to update the display during gameplay with the ever increasing score. I got only a few months of coding experience, and only JS.