Hellession / ImprovedWaterWheel

Town of Salem mod that overhauls the Water Wheel scene to make it more unpredictable.
GNU Lesser General Public License v3.0
3 stars 0 forks source link

Role Flash is abnormally tall on screens smaller than 1440p #2

Open Hellession opened 1 year ago

Hellession commented 1 year ago

Intended (correct) behavior: image

Buggy behavior (seen on Tuba's streams at all times): image

I have also seen this buggy behavior on proxz's streams.

I honestly still don't know the root cause of why this is happening and how to fix this. My initial idea was that it had something to do with my shader that I tried to use (that doesn't work). However my shader has nothing to do with the role flash. The role flash is always resized to be as tall as the selected role slot that you end up landing on. The role slot's size is assigned to RoleSlotHeightReal, which is fired before the entire animation is even generated. The selected role slot should be of normal size at this point (unless some weird layout shit is going on).

I am fairly sure this has something to do with screen sizes. My main monitor that I always play with is 1440p. Meanwhile most players would probably have a 1080p monitor. Town of Salem uses a Unity system, which rescales all UI elements to fix your screen, no matter what resolution you have. This means that the actual (in-game) canvas size should always remain the same. While working on the mod I needed the numbers, so here they are: Town of Salem's UI Canvas is 2368.827x1334.215. I don't know why these numbers are the way they are, but that's what I got. I still have a line of code that outputs the sizes on this line. The height of the Canvas is almost the same as 1440p. This would explain why for me it usually looks good... well, almost good. If you look closely on my screenshot, there's some area of the role slot that isn't covered by the role flash. This is because my screen is larger than ToS' UI. Meanwhile for players whose screen is smaller than the base UI, the role flash appears abnormally high. That still doesn't make sense though. Regardless of the situation, the canvas height should be the same no matter what your screen size is, which shouldn't cause any problems for the size of the role slot. Why is it that everything is scaled properly, but this isn't?

Maybe the size of the role flash needs to be redone to have anchors at min 0,0 and max 1,1 with 0 offsets. In Unity you can do this to make a RectTransform always be the same size as the parent.