guycalledfrank / bakery-issues

Bug tracker for Bakery
4 stars 0 forks source link

Unable to close popup window #137

Open pedropla opened 2 years ago

pedropla commented 2 years ago

I accidentally tried to add a second Bakery light to an object. This popup window popped up, and when I try to close it, it pops up again. The only solution is hard killing Unity.

image

Edit: Even after restarting the popup is still appearing.. I'll have to edit the code to remove it so I can just start Unity.

guycalledfrank commented 2 years ago

Hi. I can't reproduce it. What Unuty version are you on? Actually, looking at the code:


            EditorUtility.DisplayDialog("Bakery", "Can't have more than one Bakery light on one object", "OK");
            DestroyImmediate(this);

So the object is deleted immediately after the message is shown.

In your case it sounds like the object is re-added by something again? Or maybe it's somehow baked into some prefab where DestroyImmediate doesn't work without unpacking the prefab? I'm not sure how it's possible to create such a prefab though.

pedropla commented 2 years ago

This was on a prefab, I have prefabs with lighting (candles, lamps, etc), and I add these scripts to the light objects of those prefabs. Could that be why?

This was on Unity 2020.3.34 I think, the one before the latest as I submitted it a while ago.

guycalledfrank commented 2 years ago

So it looks like you applied the overrides on the prefab after 2 point light components were added. Maybe... you added the component on multiple selected objects in the prefab, and the second one wasn't shown. Then applied the overrides and... it happened. Actually no, I can't reproduce it either. Not sure how you did that. Prefabs just mess everything up.

Anyway, I've added a little fix where it only shows the popup once, but then next time it just prints it to console, so shouldn't lock you, and you should be able to remove the component by hand: https://github.com/guycalledfrank/bakery-csharp/commit/8efceee65386bcd04611615be9f5dd71b65d1be8

pedropla commented 2 years ago

I understand it can sometimes be hard to reproduce these issues with prefabs in Unity. I think this fix should work. I'll test it out when I can.