GlitchEnzo / NuGetForUnity

A NuGet Package Manager for Unity
MIT License
2.92k stars 303 forks source link

Checking of checkboxes anywhere in the Inspector deselects the currently selected gameobject #660

Closed Geminior closed 5 hours ago

Geminior commented 1 week ago

The plugin makes interaction with checkboxes unusable.

It is trivial to reproduce:

  1. Find/Create a prefab with a Monobehaviour that exposes a boolean
  2. Click the checkbox in the Inspector
  3. Observe that the selection is cleared (Inspector goes blank)

This is on Unity version 2022.3.23. I have not tried other versions.

igor84 commented 1 week ago

Hi @Geminior. Can you provide information on why you think this is related with NugetForUnity? Also what version of Unity and plugin are you using?

Geminior commented 1 week ago

I realize it sounds unrelated, however, it simply starts occurring once NugetForUnity is added to the project, and once removed it returns to normal. I have updated the original report with the Unity version number, which may be relevant.

igor84 commented 1 week ago

I tried reproducing this in Unity 2022.3.23f1 but everything seems to work. I installed NugetforUnity through Unity package manager and I even installed a few packages. @Geminior can you reproduce this in a new empty project?

Geminior commented 1 week ago

Hmm I will try, I suppose it could be some incompatibility with some other package.

On Fri, Jul 5, 2024 at 12:06 PM Igor Stojković @.***> wrote:

I tried reproducing this in Unity 2022.3.23f1 but everything seems to work. I installed NugetforUnity through Unity package manager and I even installed a few packages. @Geminior https://github.com/Geminior can you reproduce this in a new empty project?

— Reply to this email directly, view it on GitHub https://github.com/GlitchEnzo/NuGetForUnity/issues/660#issuecomment-2210592343, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJC5LEKQYADPCGQ4BWZMALZKZVZFAVCNFSM6AAAAABKLANVOKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJQGU4TEMZUGM . You are receiving this because you were mentioned.Message ID: @.***>

Geminior commented 1 week ago

@igor84 Ok, so I have managed to reproduce it in a blank project.

It only happens when clicking checkboxes on a component on a Prefab, and only if the component has a Custom Editor. I have attached a sample project that shows the issue, and a video as well.

To reproduce in the project:

  1. Select the 'SelectMe' prefab
  2. Click the 'Click to fail' checkbox
  3. Observe that the selected GameObject is deselected

https://github.com/GlitchEnzo/NuGetForUnity/assets/1191596/aa739fa5-5261-41c9-9b2b-7112e815360f

NugetIssue.zip

igor84 commented 1 week ago

@Geminior thank you for the repro project. I managed to isolate that the call to AssetDatabase.StopAssetEditing in NugetAssetPostprocessor.cs is causing Unity to deselect the editing object on edit. I made a fix in pull request #661.

Geminior commented 1 week ago

Sweet, thanks for the swift update, glad you were able to locate the issue :)

igor84 commented 5 hours ago

Fix is merged into master.