Closed VladimirMarko closed 2 years ago
Hi @VladimirMarko - thanks, glad you've found a workaround.
There shou'd be a '-' in that table.
If not you can have a look with debugger what's happening, the code that draws it is in MissingUnityEventsManagerEditorWindow :172
if (GUILayout.Button("-", PercentageWidth(8)))
{
_config.EventConfigurationEntries.RemoveAt(i);
}
OK, I've been playing with this and I found out that consistently PercentageWidth(66)
instead of PercentageWidth(100)
means the whole window width for both GUILayout
and EditorGUILayout
static methods/UI elements.
I had no idea why. Then I checked DPI scaling and sure enough, it was 150%. So that's the problem. The way you use width is not robust with respect to DPI scaling (at least on Windows 10).
DPI scaling = 100%:
DPI scaling = 150%:
DPI scaling = 175%:
Hm... I cannot figure out a clean solution to this.
The crux of the matter is that GUILayout.Button("A window-wide button", GUILayout.Width(Screen.width));
produces a button that will be wider than its window, if DPI scaling is above 100%.
We have Screen.dpi
, but that's the absolute value and not a scaling factor. The base value is system-dependent (e.g., normally 96 PPI on Windows) and the Unity API does not seem to allow us to get it for the current system.
Some external packages might help, but as I understand it, Unity does not play well with the NuGet package manager, so adding them as dependencies would be non-kosher, I suspect. I am not sure about this point.
In any case, I filed a bug report with Unity, as I assume that this discrepancy in behavior between GUILayout.Width
and Screen.width
is unintended.
As a workaround, I would suggest defining the UI elements using just absolute pixel values. I don't know whether there is a better way.
Nevermind. I figured it out.
Apparently the correct thing to use is position.width
(inherited from EditorWindow
), instead of Screen.width
.
I will submit a pull request.
Thanks @VladimirMarko that's some good investigation and fix
In this package's UI, in the "Missing Unity Events" panel, there's an editable list of types and their properties. There is a button labeled "Add New Event" that adds a new entry to this list. There is no way to remove entries from this list - it can only grow. The entries persist over Unity restarts.
In other words, I cannot get rid of the empty entries marked by the exclamation mark, only add more.
EDIT: I figured out that you can reset everything via
Tools
->Missing Unity Events
->Recreate Config
. That's however not ideal, of course.