Search Issue Tracker
Fixed in 2023.2.5f1
Fixed in 2023.2.X, 2023.3.X, 7000.0.0a1, future release
Votes
0
Found in
2023.2.0a14
2023.3.0a1
Issue ID
UUM-34515
Regression
No
[Windows] moving window with .position across monitors with multiple dpi has the wrong size
When setting the position/size of a windows with .position, if the new place is on a screen that have a different DPI it will not get the right size. You sometime need to set the position twice to move it to the expected position
You can test it with the following code which is a modified version of [https://docs.unity3d.com/ScriptReference/EditorWindow-position.html]
{code:java}
// The position of the window is displayed when it is
// external from Unity.
using UnityEngine;
using UnityEditor;
public class PositionExample : EditorWindow
{
Vector2Int p1;
Vector2Int p2;
bool showBtn = true; [MenuItem("Examples/position")]
static void Init()
{
GetWindow<PositionExample>("position");
} void OnGUI()
{
Rect r = position;
GUILayout.Label($"Position: {r.x}x{r.y}({r.width}-{r.height})"); p1 = EditorGUILayout.Vector2IntField("Set the position:", p1);
p2 = EditorGUILayout.Vector2IntField("Set the size:", p2);
if (showBtn)
{
if (GUILayout.Button("Accept new position"))
{
r.x = p1.x;
r.y = p1.y;
r.width = p2.x;
r.height = p2.y; position = r;
}
}
}
} {code}
set it to a position on the first screen with a size of 640x480 and then change the position to appear on the second screen. The size will not be the good one.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Spring Joint shows only one anchor gizmo in Scene view when "Auto Configure Connected Anchor" is enabled
- Crash on _platform_memmove after entering large value in Graphics settings Preloaded Shaders field
- Disproportionally large impact on CPU frame time when writing to a rendering entity's LocalToWorld
- "Constant Force" Component numeric fields drift out of view while entering a really big value in the Inspector
- Scene view camera speed pop-up appears empty or cut off when Scene view is very narrow
Resolution Note (fix version 2023.2.5f1):
Bug Resolution - [Windows] moving window with .position across monitors with multiple dpi has the wrong size. This has a linked issue of [Windows] moving window with .position across monitors with multiple dpi has the wrong position values. We plan to address this issue if a more compelling case comes up for it.
Resolution Note (fix version 7000.0.0a1):
Bug Resolution - [Windows] moving window with .position across monitors with multiple dpi has the wrong size. This has a linked issue of [Windows] moving window with .position across monitors with multiple dpi has the wrong position values. We plan to address this issue if a more compelling case comes up for it.
Resolution Note (fix version 2023.3):
Bug Resolution - [Windows] moving window with .position across monitors with multiple dpi has the wrong size
Resolution Note (fix version 2023.2):
Bug Resolution - [Windows] moving window with .position across monitors with multiple dpi has the wrong size