keenanwoodall / Deform

A fully-featured deformer system for Unity that lets you stack effects to animate models in real-time

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Editor bug in 2021.3.4 / Deform 1.2.1: Cannot add menu item

3ternal opened this issue · comments

Describe the bug
Whenever my code recompiles, I get the following warnings in the editor:

Cannot add menu item 'Tools/Deform/Settings' for method 'DeformEditor.DeformSettingsWindow.ShowWindow' because a menu item with the same name already exists.
UnityEditor.MenuService:GetMenuItemsFromAttributes ()
Cannot add menu item 'Window/Deform/Settings' for method 'DeformEditor.DeformSettingsWindow.ShowWindow' because a menu item with the same name already exists.
UnityEditor.MenuService:GetMenuItemsFromAttributes ()

To Reproduce
Steps to reproduce the behavior:

  1. Make any change to a script
  2. Look at the editor console

Expected behavior
No warnings are expected

Screenshots
n/a

  • OS: Windows 10
  • Unity: 2021.3.4
  • Deform version: 1.2.1

Additional context
n/a

Thanks for the report! I’m curious, is Deform installed through the package manager, or was it downloaded from the Asset Store? I’m also curious if you get the error in a fresh project. My first guess would be that Deform is installed twice somehow, but it could totally be a bug or a result of some API change in 2021.3.4.

I’m in the process of moving across the country and will not have access to my computer for the next week, but I will try and repro as soon as I’m settled 👍

Hi, thanks for the quick reply! Sure, no rush.

It was installed through the package manager. That said, it looks like I can't reproduce it in a fresh project. But I haven't used Deform too heavily, and I certainly didn't have a reason to add anything to Window/Deform or Tools/Deform in my own editor scripts.

Any thoughts on what to look for to detect if it was installed twice somehow? If I type in "deform", I'm only seeing one asmdef, for instance.

EDIT: Also, if I might ask, is there a reason why packages like In-App Purchases and Version Control are listed as dependencies for Deform? I had previously uninstalled them, but when I tried to import Deform again, I received a prompt to install other dependencies first, and those packages + a couple more came back.

It sounds like it isn’t installed twice. The next thing I’d try is deleting your Library/ folder. Unity caches files there, including remote packages, and I’ve seen it mess up before. Deleting it should trigger a rebuild, although it will have to reimport everything else in your project as well which could take a bit if your project is large.

Deform only has a dependency on Burst, so I’m not sure why In-App Purchases and Version Control would be listed. I don’t think Burst would have those dependencies either. What dependencies are listed in Deforms package.json file?

Interesting - Deform only lists Burst as a dependency, you are correct. This seems like it might be a common issue: https://forum.unity.com/threads/unity-package-has-package-manager-dependencies.985585/

When I imported Deform and allowed it to install dependencies, I noticed something in the console about "update mode: mergeDefaultDependencies", so maybe that has something to do with it?

Packages were changed.
Update Mode: mergeDefaultDependencies

The following packages were added:
  com.unity.ads@3.7.1
  com.unity.analytics@3.5.3
  com.unity.collab-proxy@1.5.7
  com.unity.ide.rider@2.0.7
  com.unity.ide.vscode@1.2.3
  com.unity.purchasing@3.1.0
  com.unity.xr.legacyinputhelpers@2.1.7

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

As for the problem at hand, you might be right. I'll probably just deal with it for now, because deleting the whole library folder is definitely a pain (and I think there are editor configs stored somewhere in there). I tried deleting a few Deform-related files, and it didn't change anything, but I agree that the library is a likely culprit.

Anyway, thanks for the help so far. I'm not sure if this immediate issue can be solved, but I am still curious about that bizarre problem with the default dependencies.

Are you able to remove the extra dependencies manually from the project manifest? Also fwiw nothing important should ever be stored in Library/ it's just a cache for generated files. You should be able to delete it safely, but you could also open it and delete the Library/PackageCache/ folder inside it instead of the whole folder.

Oh, interesting. So, I can manually remove those dependencies from the project manifest, and this causes the project to recompile as the packages are removed from the project itself. But when I import Deform, I still get the same prompt about installing dependencies, and I can see that those entries are being automatically added back to the manifest.json.

This occurs in a fresh project, btw, so you might be able to reproduce it.

As for my main project, removing the Library/PackageCache unfortunately didn't do anything, but it's good to know that it seemingly didn't break anything either.

Hey, bit of progress on this one: I was able to solve the editor warning. Turns out I had a file called DefaultSettingsWindow.cs located in Deform/Code/Editor, and it wasn't even supposed to be there. Perhaps it was from an earlier version. It looks like that file isn't included in the package right now, so I deleted it, and I think we're good.

That said, the other issue with the incorrect dependencies is still there, and I think you'll be able to reproduce that one, so please let me know how that goes when you get a chance. We could move that to another thread if you want since this one is technically resolved now.

Thanks again for the help earlier.

Good call. New issue #72 created for the dependencies. I'll close this one now that it's been resolved.