View Issue Details

IDProjectCategoryLast Update
0000944AI War 1 / ClassicGUIDec 22, 2010 11:03 pm
ReporterKalzarius Assigned ToChris_McElligottPark  
Status resolvedResolutionfixed 
Product Version4.000 
Fixed in Version4.054 
Summary0000944: Wave Warning Box Changes Size
DescriptionWhen 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.
TagsNo tags attached.
Internal Weight

Activities

Chris_McElligottPark

Dec 20, 2010 5:52 pm

administrator   ~0006485

This isn't something we can easily fix.

Kalzarius

Dec 21, 2010 1:41 am

reporter   ~0006587

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

Chris_McElligottPark

Dec 21, 2010 11:24 am

administrator   ~0006611

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.

Kalzarius

Dec 22, 2010 3:32 am

reporter   ~0006727

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).

Chris_McElligottPark

Dec 22, 2010 10:46 pm

administrator   ~0006812

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.

Kalzarius

Dec 22, 2010 10:59 pm

reporter   ~0006815

Yaaaaay! :D

Thanks so much.

Chris_McElligottPark

Dec 22, 2010 11:00 pm

administrator   ~0006816

You bet. Sorry about the passive-aggressive thanks in the release notes, it's meant in good humor. ;)

Kalzarius

Dec 22, 2010 11:02 pm

reporter   ~0006817

XD

Chris_McElligottPark

Dec 22, 2010 11:03 pm

administrator   ~0006818

:P

Issue History

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