Comments (30)
@SolidAlloy Thanks! Good work!
from classtypereference-for-unity.
In Console
from classtypereference-for-unity.
NullReference fixed by switch .NET to 4. But DropDown still empty =(
from classtypereference-for-unity.
from classtypereference-for-unity.
Hi, sorry for the late response. I'll take a look at it today
from classtypereference-for-unity.
Thanks!
from classtypereference-for-unity.
It works without issues for me in versions 2019.4.11 and 2020.2.0 on Windows. I also tried switching between .NET 2.0 and 4.x, and it didn't cause any errors. I'm very surprised to see there is a difference in code execution on .NET 2.0 and 4.x, as nothing in the code should produce such an error.
Is your default assembly called Assembly-CSharp? If not, it can theoretically produce an empty drop-down.
Please try using 2.6.2 again and import Usage Samples from Package Manager. Open the Demo scene inside the sample and check if the drop-down menus are empty there too.
from classtypereference-for-unity.
I used Samples and when I start project I saw this Warnings and DropDown still empty
And judging by Rider editor assembly called Assembly-CSharp
from classtypereference-for-unity.
Hey! If add DropdownHeight = 300 it works, but place left, it is weird =D
from classtypereference-for-unity.
I think issue in DropDownWindow.AdjustSizeIfNeeded() Debug.Log(1) called once but Debug.Log(2) infinite loop until close DropDown.
from classtypereference-for-unity.
Thanks for the debugging! I'll check what causes this behavior and get back to you
from classtypereference-for-unity.
Thanks!
from classtypereference-for-unity.
If windowSize.height == 0
ShowAsDropDown
doesn't call OnGUI
and DrawContent
doesn't called too and doesn't calculate contentHeight
I added windowHeight == 0f ? 1 : windowHeight
and change f (_contentHeight == 1f || Event.current.type == EventType.Repaint) _contentHeight = contentHeight;
in DrawContent
and it works!
But window appears in left and up of screen this still needs to be finalized =D
And still looping in update
I think it is macOS problems. Unity windows often appears in left instead of right =D But it possible fix by change x position in Resize method.
from classtypereference-for-unity.
I just pushed an update that fixes different DropdownWindow position issues. Please update ClassTypeReference to 2.6.3 and check how it works on your end. I didn't include your suggestion to change the window height to 1 pixel yet because the update to 2.6.3 may have already fixed it. But if it still doesn't work for you, I will include your fix too. In the end, it may really be a MacOS-specific issue.
The amount of work put into just showing a window in the right place is huge. I wish Unity made it easier π
from classtypereference-for-unity.
I updated both dependencies and something went wrong =D
from classtypereference-for-unity.
I replaced EditorGUIUtility.GetMainWindowPosition() with Screen.currentResolution it fix this problem but DropDown still empty and onGUI doesn't called with zero height. And still in left corner =D
from classtypereference-for-unity.
I added windowHeight == 0 ? 1 : windowHeight
and if (_contentHeight == 1f || Event.current.type == EventType.Repaint) _contentHeight = contentHeight;
in DrawContent()
it works.
Now by Y axis this work properly, but X axis on left =D
from classtypereference-for-unity.
@SolidAlloy SolidUtilities has critical bug with GetMainWindowPosition. Dependency doesn't has this method.
from classtypereference-for-unity.
Sorry about that, the bug has been fixed, and ClassTypeReference 2.6.4 should be working fine now.
I created the max-os-position-fix branch to further investigate the issue you have with the drop-down position.
I added a change there, that initiates the drop-down window with a 100 height instead of 0 (long story short, the height of 1 messes up with the drop-down position on Windows, so 100 should work on both platforms). Please check that the drop-down is at least non-empty now. Please follow these steps to install the package in this branch:
- Remove SolidUtilities and ClassTypeReference if you have them installed.
- Package Manager -> Add package from Git URL.
- Enter "https://github.com/SolidAlloy/SolidUtilities.git#mac-os-position-fix".
- Enter "https://github.com/SolidAlloy/ClassTypeReference-for-Unity.git#mac-os-position-fix".
Sorry for having to investigate it on your end π If only I had a Mac to test it on.
As for the X-axis issue, I think it has something to do with resizing inside of AdjustSizeIfNeeded(). I will add more debug logs in mac-os-position-fix, and I hope we'll find the root cause soon.
from classtypereference-for-unity.
New versions with new errors =)
from classtypereference-for-unity.
I cached _windowPosition OnCreate and used it after Resize and it works properly.
from classtypereference-for-unity.
OK, now I checked the code against Unity 2019 and correctly placed preprocessor directives. The plugin should finally work without critical errors in Unity 2019.
The Y axis worked for you before, it was the X axis that had the issue, wasn't it? Did setting the height to 100 inside OnCreate() resolve the empty drop-down issue?
The Y position of the window may change later, so just caching it is not a solution, unfortunately. If the drop-down is opened too close to the bottom of the screen, there is not enough place for it, so the window is raised so that it has enough height.
However, I see you also set the X position of the window after this.Resize(height: wantedHeight)
, so this is a hint. I think the X position changes to 0 inside Resize(), and you revert it back with your positionToAdjust.x = ...
line. First-of-all, I merged two Resize() calls into one inside AdjustSizeIfNeeded(). It will be more efficient and will let us pinpoint the root cause sooner. Can you check the drop-down with the latest commits to the mac-os-position-fix branches? Does it work as expected, or the X axis still changes to 0?
I added a few debug logs to check the X position of the window during its creation and resizing.
from classtypereference-for-unity.
X axis is 0. Height 100 inside OnCreate works properly =)
from classtypereference-for-unity.
It looks like ShowAsDropDown kill x position =D
from classtypereference-for-unity.
That's weird π
I noticed that an incorrect window X position was being set on the window creation, so I fixed it. Could you get the version with the latest commits from the mac-os-position-fix branch and check if it resolved the 0 X position issue? If not, I have another solution in mind that I can apply.
from classtypereference-for-unity.
It is still zero =)
these links
Enter "https://github.com/SolidAlloy/SolidUtilities.git#mac-os-position-fix".
Enter "https://github.com/SolidAlloy/ClassTypeReference-for-Unity.git#mac-os-position-fix".
from classtypereference-for-unity.
from classtypereference-for-unity.
Hi, I pushed an update to ClassTypeReference in which the window position is set once again during its first Update after the creation. Please checkout ClassTypeReference in the max-os-position-fix branch and SolidUtilities in the master branch:
https://github.com/SolidAlloy/SolidUtilities.git
https://github.com/SolidAlloy/ClassTypeReference-for-Unity.git#mac-os-position-fix
Let me know if it worked
from classtypereference-for-unity.
@SolidAlloy Now it has error but after import ChildProperties it works properly! =)
from classtypereference-for-unity.
Glad to hear it! :) I fixed the error in the sample and merged the fix to master. You can use ClassTypeReference 2.7.0 now
from classtypereference-for-unity.
Related Issues (20)
- The type 'MonoScript' is defined in an assembly that is not referenced. HOT 1
- TypeReference dropdown does not respect [Inherits] Attribute constraints HOT 8
- The following workaround seems to work:
- DLL conflicts with Cysharp packages HOT 2
- Unsupported type TypeReference HOT 2
- NullReferenceException HOT 2
- Dropdown goes to top left of screen on unity version 2021.1.21f HOT 8
- NullReferenceException when adding asset via GenericUnityObjects HOT 2
- System.Memory.dll present in Unity 2021.2.0f1 HOT 5
- README still references old package name com.solidalloy.type.references HOT 3
- Only works with scriptable objects for me HOT 2
- UIElements Or Checking When Value Has Changed HOT 2
- Cant import sample HOT 1
- ExcludeNone feature bronen in latest release HOT 1
- Cannot install due to to invalid dependencies HOT 1
- GUID conflict HOT 1
- TargetFramework issue with other packages HOT 1
- Freezing Issues Inside VisualElement Container HOT 2
- The attribute 'Short Name' doesn't work when you search the drop down. HOT 1
- Unity 2022.3.4f1 NullReferenceException: Object reference not set to an instance of an object HOT 6
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 classtypereference-for-unity.