Comments (6)
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);
}
from unity.missingunityevents.
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).
from unity.missingunityevents.
DPI scaling = 100%:
DPI scaling = 150%:
DPI scaling = 175%:
from unity.missingunityevents.
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.
from unity.missingunityevents.
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.
from unity.missingunityevents.
Thanks @VladimirMarko that's some good investigation and fix
from unity.missingunityevents.
Related Issues (14)
- Events are not triggered when using undo in the editor. HOT 2
- The "standard"/obvious usecase is broken. HOT 1
- Causes Burst compiler to throw exceptions. HOT 3
- Unknown editor freeze in play mode. HOT 3
- Behaviour.enabled cannot be bound HOT 1
- Package gives error of missing meta files HOT 2
- [Recommendation] MenuItem location customization HOT 3
- DirectoryNotFoundException: Could not find a part of the path HOT 4
- Don't know why is not working :( HOT 3
- Can't Modify CoreModule DLL HOT 10
- how to insert event in functions HOT 1
- Hi, Helper class has many repetitive class names? HOT 1
- VirusTotal check gives positive results HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity.missingunityevents.