A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Separate names with a comma.
Discussion in 'Editor & General Support' started by WinterboltGames, May 30, 2021.
Also happening in 2022.3.4
I never saw this in 2021x or prior.
And with the constant shutting down via task manager I now get corrupted libraries and have to rebuild those more often.
I'm not even sure how to debug this. The editor log doesn't say anything useful, and the profiler stops responding when the popup appears.
I haven't been able to reproduce it consistently either. Sometimes it shuts down without issue, other times it hangs- usually after doing a good amount of work in the editor.
Can you capture a dump file of Unity.exe from the task manager when this happens and send it to me?
Thanks for the dump. Can you try removing com.unity.localization package from your project and check if that makes this go away?
Also, can you tell me how long you waited before you captured the dump? Was it at least 30 seconds?
Yes, I have waited at least 30 seconds. One time I let it run and it did finish after 12 minutes(I checked the editor log).
I will look into removing the localization package, but it will not be trivial because it is used throughout the code. I do have another issue with the localization package which may be related and which I have reported.- https://forum.unity.com/threads/obj...-during-a-domain-backup.1461953/#post-9153218
The dump is pointing at execution being stuck in the finalizer of UnityEditor.Localization.UI.LocalizedReferencePropertyDrawer`1 class. It is unsubscribing from a global static event, which at the time of the dump capture has 26651 subscriptions. Unsubscribing from an event that has a lot of subscriptions is a pretty heavy operation:
1. Find the delegate in the delegate array you need to remove;
2. Allocate a new array of "size - 1";
2. Copy all the elements except the one you're trying to remove to the new array.
This is easily O(n) operation where n is the number of event subscriptions. Now you take 26k of them and that explains why it takes so long to clean up. I'll bring this up internally.
I have done some investigation into the localization issue. It would appear to be an issue with property drawers. The finalizer doesnt seem to get called until entering playmode or an assembly reload is going to occur. This can cause a lot of property drawers to leak over time which all then clean themselves up later on.
I have created a bug so you can track the issue https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-44220
Do these objects also get cleaned up during a domain reload? Maybe that is why domain reload appears to hang or get stuck for a long time for some users.
It's possible but there's a lot of other things that can also cause that.
Yes, domain reload is what triggers the cleanup. And enter playmode/recompiling scripts triggers domain reload by default.
Wanted to stick my oar in as well, because I was having this issue, too. Unity 2022.3.2f1, DOTS packages installed (Entities, Entities Graphics, Unity Physics, Burst, Mathematics & Packages). Shutting down Unity would put me in an endless loop of 'CleanupMono'.
In my case the culprit was... Shader Graph! Closing the two Graph Editors I still had open completely fixed it. As was reported previously, try closing unnecessary EditorWindow instances. One of them is possibly bugged and stalling.
I looked into this further in my project and thought I would share my findings. While the root cause is still "property drawers not being finalized", what was causing thousands and thousands of event subscription in the LocalizedString property drawer in the first place was in fact the Odin Inspector package on the asset store. For whatever reason, the Localization module in Odin causes LocalizedString property drawers to be constructed every gui event update, so even doing a mousemove over the property drawer would cause it to be constructed every frame. I have tested normal property drawers and they are just constructed once.
That's strange. There's supposed to be an exception in Odin to prevent it from drawing the localization property drawers because it tends to break them. You can tell when it's drawing them because the table selection popup gets replaced by 2 text fields. Maybe this is a bug in Odin when dealing with ignored fields.
I build my project once and resolve this problem
This issue does seem strange - we will look into it and get it resolved promptly if our Localization module is at fault It's possible there's some problem in how we manage the lifetime of the Unity property drawers we create in certain situations.
I get this a lot with text mesh pro, we have an application with potentially thousands of labels (for moving ship names) and often it hangs in the unsubscribing of all the labels - this can be seen by pausing VS and viewing the threads, there's usually one running after the application has stopped and just hangs the Editor UI
Still present in 2022.3.10f1.
I've been working on a modification that introduces support for IDisposable to property drawers, although it hasn't been merged yet. To utilize this enhancement, you'll require both the Unity version incorporating this support and the updated localization package, likely to be included in version 1.5.0 (currently not available).
Regarding the recent issue, I haven't identified a specific reason for it emerging after a particular Unity version. There don't seem to be any unusual elements in the property drawer code that could have exacerbated the situation. I suspect there may be more than one root cause for this issue.
If you're not utilizing the localization package, the issue you're facing is likely unrelated, and the mentioned solutions won't apply. If you have encountered this in an example project, I encourage you to file a bug report for further investigation.
Completely off-topic, but while you're there could you introduce a virtual Initialize() method to property drawers at the same time? Combined with IDispoable support, it would make them about 200% more useful.
I'm afraid it's too late now, my pr is just going through review. What would initialize do that you can't do in the constructor or the Attach to panel event when using UI Toolkit?
Well I didn't know you could use a constructor as nothing in the docs indicates that you can do that. Having a method one can override would be immediately obvious as to its purpose even without documentation.
Understand it's not an issue with UI toolkit as it doesn't run every repaint, though there's still lots of situations where we need to use IMGUI as we can't use UI Toolkit inside of IMGUI editor.
Pretty much every kind of Odin Inspector drawer and processor has a virtual Initialize() method. A constructor could be used, sure, but it's just an immediately obvious thing to have that makes using their API so much better.
Just a heads up that this fixed the issue for em as as well, closing the Shader graph tab. unity 2022.3 LTS
To add to this, I want to note that we finally did track down the cause of this issue (which in the case of Localization + Odin, was on our end - it seems other assets/packages are causing similar trouble as well). With the release of Odin 3.2 the issue should be resolved.
The way Localization drawers are called is also totally different now, and Odin should not be causing any trouble drawing Localization types at all any more. We are also working on a far improved custom support module for Localization that includes lots of extra Odin niceness and extra functionality that should hopefully greatly improve the experience of using Unity's Localization package
Omg, That helped like a charm!
this bug is rise up every time. stress...
It hapens to me since I started using Odin as well, but at the same time I switched to new Localization package and newer version of Unity, so not sure what causing it yet.
Currently it happened with Unity 2023.2.7f1, Odin 18.104.22.168 and Localization 1.4.5
This problem persists in version v.2022.3.19f1
In my case, it has something to do with the number of gameobjects in the scene.
If my scene has few gameobjects then the application quits properly, but if the scene has many objects then it freezes when I call Application.Quit
This is what I get on Player.log :
[ALLOC_TEMP_TLS] TLS Allocator
Peak usage frame count: [256.0 KB-0.5 MB]: 256 frames, [0.5 MB-1.0 MB]: 439 frames, [1.0 MB-2.0 MB]: 1 frames, [4.0 MB-8.0 MB]: 3 frames
Initial Block Size 4.0 MB
Current Block Size 6.5 MB
Peak Allocated Bytes 6.5 MB
Overflow Count 0
[ALLOC_TEMP_Background Job.worker 4]
Initial Block Size 32.0 KB
Current Block Size 32.0 KB
Peak Allocated Bytes 54 B
Overflow Count 0
Initial Block Size 256.0 KB
Current Block Size 504.0 KB
Peak Allocated Bytes 486.6 KB
Overflow Count 53
[Many blocks like this]
Any ideas on this?
Problem still exists!