Author Topic: [workaround] 3.4.8 Blurred UI if Anchor is set to target's center  (Read 2832 times)

EvanT

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Since UIAnchor is depreciated and does not update on start but only on resize I decided to use the new (to me) UIWidget-Anchor system.

Well while the panel is in Pixel perfect scale mode I get blurry results as can be seen in the attached pic (the picture is the mixed result of two screen shoots at different resolutions) depending on screen resolution.

I even tried a whole new scene with the same result.

edit: After some more testing I found that it is related to the "Target's center" setting left and right work well but if set to centre it will blur depending on vertical and/or horizontal screen size. E.g. If you set it to Top-Center it will blur depending on screen.width, Center-Left -> screen.height and center-center -> both.
« Last Edit: February 09, 2014, 07:02:37 PM by EvanT »

EvanT

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: 3.4.8 Blurred UI if Anchor is set to target's center
« Reply #1 on: February 08, 2014, 05:50:02 AM »
Hello Again,

I have reproduced this behaviour in the Drag-Example as soon as one of the Anchor-Target-Axis is set to "Target's Centre" the widget and its children become blurry on that axis.

So is there a workaround or is this somehow my fault (I would prefer the later because that one I could fix by myself)?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.4.8 Blurred UI if Anchor is set to target's center
« Reply #2 on: February 08, 2014, 02:26:01 PM »
Make sure your game window uses dimensions that are dividable by two (ie: 1098x578 rather than 1098x577). That's about all I can suggest, as changing the anchors to center doesn't cause any visible changes in my case.

EvanT

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: 3.4.8 Blurred UI if Anchor is set to target's center
« Reply #3 on: February 08, 2014, 03:47:17 PM »
Hi, I watched the transform values in the inspector while rescaling the window. If you set the anchor to something different than "target's centre" the coordinates sometimes are floating point numbers as is expected. But if you set it to "target's centre" the values keep being some whole number, which causes the blurriness.

While "keep the resolution even" works perfectly fine for full screen in windowed-mode that approach is rather futile. Or is there some setting to force even resolutions?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.4.8 Blurred UI if Anchor is set to target's center
« Reply #4 on: February 09, 2014, 04:11:43 PM »
You can change Screen.width and Screen.height as you see fit via Screen.SetResolution.

EvanT

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: [workaround] 3.4.8 Blurred UI if Anchor is set to target's center
« Reply #5 on: February 12, 2014, 05:04:03 AM »
This workaround is ineffective if you have a sprite's or label's edge anchored to the centre of a resizeable widget. (UIDragResize)

And this looks rather hacky
  1. if(!Screen.fullScreen) if(Screen.width%2!=0 || Screen.height%2!=0) {
  2.         Screen.SetResolution(
  3.                 Screen.width%2!=0?Screen.width-1:Screen.width,
  4.                 Screen.height%2!=0?Screen.height-1:Screen.height,
  5.                 Screen.fullScreen);
  6. }