Search Issue Tracker
Fixed
Fixed in 2023.2.5f1, 2023.3.0a10, 7000.0.0a1
Votes
0
Found in
2023.2.0a14
2023.3.0a1
7000.0.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
- "Draw Additional Lights Shadowmap" calls increase when custom MaterialBlockProperty is used
- Crash on _platform_memmove when importing the "Dragon Crashers - URP 2D Sample Project" to a new 2D project
- "Shader is not supported on this GPU" warnings and and shaders are not loading when building the project for non-Chromium browsers
- [iOS][URP] The screen flickers and the "Execution of the command buffer was aborted due to an error during execution" error is thrown continuously
- Shortcut Manager shows empty conflict filter when resolving runtime conflicts involving different contexts
Resolution Note:
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.0a10):
Bug Resolution - [Windows] moving window with .position across monitors with multiple dpi has the wrong size
Resolution Note (fix version 2023.2.5f1):
Bug Resolution - [Windows] moving window with .position across monitors with multiple dpi has the wrong size