Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MrTact

Pages: [1] 2 3
1
Feeling the same pain points: any UI that has dynamically-added child widgets usually gets mocked up as a static UI by our artist, which I then take to convert repeated things into prefabs that get dynamically instantiated. Any workflow tips on this, or is that as good as it gets?

I wish I did. Sadly, I don't have any useful advice beyond "acquaint yourself well with the NGUITools class."

2
This is very similar to what we actually did on SWAT, although it's all hand-crafted code.

3
NGUI 3 Support / Re: Fonts - Best Practice
« on: April 03, 2014, 11:56:38 AM »
On Star Wars: Assault Team, we used dynamic fonts almost exclusively. (The exception is that we needed justified text for the opening crawl, which wasn't available in NGUI at the time, so we ended up bringing in CCText just for that.) We used Orbitron from The League of Moveable Type because it's available on an open license and it has the right "feel" for our project. I suspect using a quality typeface is a big factor in how good your dynamic fonts look.

4
Thanks for posting the game,

Would love to get some feedback on the following:

1. Pain points with NGUI
2. What and how it could be improved.
3. Would having components that have DataProvider functionality help.  Ex:  Feed in an xml or json to a scrollList comp and it auto populates.  Something like Adobe Flex but without the bulk.  Just a dataProvider and more developed component architecture.

Pain points:
Depth! Mostly fixed by the big update in December. This actually caused us to explore using Scaleform early in the development cycle, because we had artists that wanted to do a lot of animation in the UI, and sliding one panel over another was nightmarish. Having lots of dynamically-added children, as we do, made that worse.

Memory usage. This helped drive decisions about how many cards you were allowed to have in inventory, because we ate a huge amount of memory by naively spawning cards and adding them to grids. Not necessarily a problem unique to NGUI, naturally. One of our engineers ended up adding an infinite scroller, similar to the one in the most recent update of NGUI, which addressed this problem.

Another big issue for us was it seemed like any time we had an issue with NGUI, the next release would fix it. Which is great, but having to constantly upgrade your UI library on a project with a relatively short dev cycle was at times terrifying. We had to fight really hard to get the December update in (4.0.5, I think?), but as it turned out, the performance benefits were huge and the depth fixes saved us a lot of sanity points.

How it could be improved:
I am actually really happy with NGUI. It's featureful and stable, not generally a resource hog, and ArenMook has been incredibly responsive to questions and bug reports throughout the development process.

There are two big improvements I'd like to see. One is dependent on functionality that doesn't currently exist in Unity, and the other is kind of fanciful.

First, the ability to compose UI elements, which probably requires nested prefabs. For example, you have a stock dialog and a stock button. If you add the buttons to the dialog, then you change the buttons, you have to crawl inside the dialog prefab's object graph and update the embedded copies of the buttons directly. We got around this with a solution that dynamically builds UI at runtime, but A) that means you can only see the UI at runtime, and B) it's a little difficult to wrap your head around, which makes it a tough tool for solving some UI problems. So yeah: prefabs inside prefabs, Unity, let's go!

Second, and currently nobody in Unity UI-land does this, is an improved workflow. The ideal workflow, for me, is for an artist or graphic designer to build UI pieces in the editor and just have engineers wire them up. Presently, all of our UI has to be hand-crafted by an engineer (aside from creating textures and comps, obviously), which shifts the burden to the people with the wrong skillset for the job, IMHO.

DataProvider stuff:
I've actually done a ton of work with data binding in WPF and Flex (the latter in a shipped Facebook game for Zynga), and it is very handy, especially for rapid prototyping. However, I have also found that it's easy to become reliant on it. Once all your data management lives in a black box, if you run into performance issues, it can be painful to debug and sometimes even more painful to fix (occasionally to the point of having to rip out the data binding and replace it with hand-crafted data population). So while it's cool, I don't see it as a panacea or a must-have feature. I guess you would say I am lukewarm on the matter.


5
That looks very nice, installing it now, I'd be interested in your thoughts about using NGUI for your game. Would you use it again? What was the development cost? How much time did you spend on the UI versus other area of the game dev.

We would absolutely use NGUI again, although by the time we get around to doing our next title, uGui will likely be out, and we will probably evaluate NGUI against that. Still a good chance we would continue to use NGUI, since we have built up considerable expertise in its use at this point.

I can't really comment on dev costs, but we spent almost exactly a year in development, including prepro. We probably started looking at GUI development around August of last year. We don't have dedicated engineering roles, but during that timeframe, I guesstimate that we devoted between half and one whole engineering FTE to UI, plus art resources on which I have no visibility :-)

6
NGUI 3 Support / Re: Dynamic Font change on the fly
« on: April 01, 2014, 02:33:28 PM »
We did something very similar to this, except that we used dynamic fonts. This worked pretty seamlessly for us. If using dynamic fonts is an option for you, I can state with confidence that that works.

8
NGUI 3 Support / Re: Font Word Wrapping Chopping up Words
« on: February 27, 2014, 12:12:07 PM »
This is still occurring as of 3.5. I spent some time digging into it but was not able to suss it out.

Some observations:
  • Interestingly, the only difference between these two labels is the one that wraps incorrectly is wider. Both are set to ShrinkContent and MaxLines = 0
  • Seems to happen more with wider typefaces. (This one is Orbitron Black, an open-source typeface from The League of Movable Type
  • It appears that the problem is with NGUIText.WrapText returning true because offset has reached textLength. It should have returned false, so the UILabel would ratchet the point size down and try to measure the text again.

I can make this test scene showing the issue available as a unity package, if that would be helpful.

9
NGUI 3 Support / Re: Does UIDragDropItem need a "dragging" flag?
« on: February 19, 2014, 07:29:06 PM »
Ah, I misspoke -- I was originally handling dragging one object on top of another by sending a message to the drop target in OnDragMove. Then I realized that I was duplicating functionality that already existed in UICamera and switched it to use OnDragOver and OnDragOut. The actual problem was that I was still getting drag over and out notification even if I dragged along a restricted axis.

What I did not realize (until I looked at it just now) is that this is probably by design. The camera sends these without regard to UIDragDropItem settings, because I expect that this is useful in other areas (such as handling gestures).

Knowing that is the case, I did in fact wedge a flag in there, but as you recommended, it's in user code where it belongs.

10
NGUI 3 Support / Re: Prefab Button OnClick
« on: February 19, 2014, 11:37:42 AM »
Wherever this code is that you are executing, add the following:

  1. public GameObject MyTest;
  2.  
  3. void Generate()
  4. {
  5.     GameObject new_room = (GameObject)Instantiate(prefab_room, Vector3.zero, Quaternion.identity);
  6.     UIButton new_room_button = new_room.GetComponentInChildren< UIButton >();
  7.     EventDelegate.Add(new_room_button.onClick, MyTest.GetComponent<MyScript>().OpenRoom);
  8. }

In the inspector, you will drag the MyTest game object into the MyTest field for this script and either save the scene or apply the change to the prefab, depending on where the script lives.

This assumes that MyScript is a MonoBehaviour, and that OpenRoom matches the signature for the button delegate.

11
NGUI 3 Support / Re: UIDragDropItem not under cursor
« on: February 19, 2014, 11:29:22 AM »
I am doing something similar and I don't have this performance issue, so I don't think NGUI is the source of the problem. My money is on two possibilities: either you have a broader performance problem that is just showing up because of drag and drop, or the object you are trying to drag is REALLY complex.

To check for the first problem, I would learn how to use the Unity profiler pane.

To investigate the second, look for the panel that owns the dragged object -- this will be the first gameobject you encounter that is a direct parent of your dragged object that has a UIPanel component. Open up the draw calls window for that panel, then run your game. If you are getting a massive number of draw calls (e.g. in the hundreds), that's likely your problem.

12
NGUI 3 Support / Does UIDragDropItem need a "dragging" flag?
« on: February 18, 2014, 01:26:54 PM »
I am currently implementing drag and drop for our UI, and I've run into a problem. The restriction-checking block in UIDragItem.OnDragStart doesn't seem to set any kind of state that I can check, and I am getting OnDragMove notifications in my UIDragItem subclass even if the drag is along a restricted axis. Is there some obvious way to get at this information without duplicating the delta check?

13
Yes, creating new fonts was less about performance concerns and more about convincing the artists to pick a handful of type sizes and stick with them :-)

14
We are in the process of upgrading to 3.0 and I have a use case that I'm not quite sure how to address with the new UILabel. We have blocks of text of varying sizes that need to fit into a particular space (think description text on inventory items). For most of our uses of UILabel, we are setting max lines = 0 and shrink to fit, which works fine. For these multiline descriptions, however, doing this can cause short lines of text to expand to fill the available space, which is not the preferred effect.

Until now we have been able to get by using one size font and letting UILabel scale it, but the only way I can see to create the desired effect here is to bake a new font at the appropriate size and use a non-scaling option (like clamp content) on the label. Is that right or am I missing something?

15
NGUI 3 Support / Re: NGUI 3.0
« on: October 01, 2013, 09:29:48 AM »
This past weekend I was actually blocked by certain bugs on the uGUI side so I got frustrated and turned back to NGUI. One thing led to another, and I ended up coding like mad for a few days, working out my frustrations by fixing everything I could in NGUI.
So what you're saying is, if we want new NGUI features, we should piss you off?  ;D

Pages: [1] 2 3