Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Closed
Geminior opened this issue Jul 4, 2024 · 8 comments

Comments

@Geminior
Copy link

Geminior commented Jul 4, 2024

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
Copy link
Collaborator

igor84 commented Jul 4, 2024

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
Copy link
Author

Geminior commented Jul 4, 2024

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
Copy link
Collaborator

igor84 commented Jul 5, 2024

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
Copy link
Author

Geminior commented Jul 5, 2024 via email

@Geminior
Copy link
Author

Geminior commented Jul 8, 2024

@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
NugetForUnityIssue.mp4

NugetIssue.zip

igor84 added a commit that referenced this issue Jul 8, 2024
This fixes issue #660 where Unity in some situations deselects the
edited object on any edit.
@igor84
Copy link
Collaborator

igor84 commented Jul 8, 2024

@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
Copy link
Author

Geminior commented Jul 8, 2024

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

igor84 added a commit that referenced this issue Jul 16, 2024
* Only execute Start/StopAssetEditing if something will change

This fixes issue #660 where Unity in some situations deselects the
edited object on any edit.

* Fixed PreprocessAsset and resolved AccessToDisposedClosure warning
@igor84
Copy link
Collaborator

igor84 commented Jul 16, 2024

Fix is merged into master.

@igor84 igor84 closed this as completed Jul 16, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants