View Issue Details
ID | Project | Category | Date Submitted | Last Update | |
---|---|---|---|---|---|
0000944 | AI War 1 / Classic | GUI | Oct 28, 2010 1:13 am | Dec 22, 2010 11:03 pm | |
Reporter | Kalzarius | Assigned To | Chris_McElligottPark | ||
Status | resolved | Resolution | fixed | ||
Product Version | 4.000 | ||||
Fixed in Version | 4.054 | ||||
Summary | 0000944: Wave Warning Box Changes Size | ||||
Description | When the wave warning time hits an interval with 1 second or 1 minute or what have you, the box shrinks in and then expands out again upon changing numbers. It should probably pick a size upon creation based on the maximum width and stick to that width. As a side note, it seems there's an awful lot of space on the right hand side of the box compared to the one or two pixels the text starts from the left side. A bit more left padding would be nice. | ||||
Tags | No tags attached. | ||||
Internal Weight | |||||
|
This isn't something we can easily fix. |
|
If you don't mind me resurrecting the bug, I may have found a possible solution if you're using Unity's GUIText class (I'm afraid I know little about Unity, so bear with me here). I found this code snippet in a search for finding GUIText width: GUI.skin.GetStyle("button").CalcSize(new GUIContent("This is a string")).x If I'm right, substituting the appropriate style in the above code and using a string made up of the warning text with all numerals as zeroes (for width) would give you the maximum width of the box. It would then be a matter of restraining the box to be no more and no less than the width of that box. Source: http://forum.unity3d.com/threads/14518-GUI-Text-pixel-width |
|
Right, we're familiar with how to get the size of strings -- we frequently do. But, doing something like "substituting with all 0s" adds a lot of transient memory usage that I'm not keen on -- because of string interning and the way concatenations work, etc, that's something that will cause transient memory usage to climb a lot faster when these alerts are present. |
|
What about just caching the size of the box when it's made? I might be missing something, but I can't see a reason for the box to change size with the text within (unless the text is getting longer than the box). |
|
Okay, okay, you twist my arm. ;) * The alerts box now remembers its widths from the last 12 seconds, and doesn't shrink below whatever the max size was during that period (it keeps track of the sizes once per second). This prevents the alerts box from jittering around in size as numbers count down on the wave timers, for instance. |
|
Yaaaaay! :D Thanks so much. |
|
You bet. Sorry about the passive-aggressive thanks in the release notes, it's meant in good humor. ;) |
|
XD |
|
:P |
Date Modified | Username | Field | Change |
---|---|---|---|
Oct 28, 2010 1:13 am | Kalzarius | New Issue | |
Dec 20, 2010 5:52 pm | Chris_McElligottPark | Note Added: 0006485 | |
Dec 20, 2010 5:52 pm | Chris_McElligottPark | Status | new => resolved |
Dec 20, 2010 5:52 pm | Chris_McElligottPark | Resolution | open => not fixable |
Dec 20, 2010 5:52 pm | Chris_McElligottPark | Assigned To | => Chris_McElligottPark |
Dec 21, 2010 1:41 am | Kalzarius | Note Added: 0006587 | |
Dec 21, 2010 11:24 am | Chris_McElligottPark | Note Added: 0006611 | |
Dec 22, 2010 3:32 am | Kalzarius | Note Added: 0006727 | |
Dec 22, 2010 10:46 pm | Chris_McElligottPark | Note Added: 0006812 | |
Dec 22, 2010 10:46 pm | Chris_McElligottPark | Resolution | not fixable => fixed |
Dec 22, 2010 10:46 pm | Chris_McElligottPark | Fixed in Version | => 4.054 |
Dec 22, 2010 10:59 pm | Kalzarius | Note Added: 0006815 | |
Dec 22, 2010 11:00 pm | Chris_McElligottPark | Note Added: 0006816 | |
Dec 22, 2010 11:02 pm | Kalzarius | Note Added: 0006817 | |
Dec 22, 2010 11:03 pm | Chris_McElligottPark | Note Added: 0006818 | |
Apr 14, 2014 9:28 am | Chris_McElligottPark | Category | Bug - UI => GUI |