WooshiiDev / HierarchyDecorator

Lightweight Unity Plugin transforming the Hierarchy into what it should be. Adds headers, styles, icons and more.
MIT License
1.02k stars 47 forks source link

Bug - Duplicate behavior name causes errors galore #74

Closed oliverbooth closed 1 year ago

oliverbooth commented 1 year ago

Current Unity version used 2021.3.27f1

Describe the bug HierarchyDecorator seems to throw an unfathomable amount of (the same) errors when adding at least one more component to an object whose name is already used in another namespace.

To Reproduce (If applicable)

Screenshots n/a

Additional context The following error is printed to the console:

Attempted to register a component that already exists.
UnityEngine.Debug:LogError (object)
HierarchyDecorator.ComponentData:RegisterCustomComponent (HierarchyDecorator.ComponentType) (at Library/PackageCache/com.wooshii.hierarchydecorator@7a0f71c371/HierarchyDecorator/Scripts/Editor/Data/ComponentData.cs:443)
HierarchyDecorator.ComponentData:RegisterCustomComponent (UnityEngine.Component) (at Library/PackageCache/com.wooshii.hierarchydecorator@7a0f71c371/HierarchyDecorator/Scripts/Editor/Data/ComponentData.cs:422)
HierarchyDecorator.ComponentIconInfo:DrawInfo (UnityEngine.Rect,UnityEngine.GameObject,HierarchyDecorator.Settings) (at Library/PackageCache/com.wooshii.hierarchydecorator@7a0f71c371/HierarchyDecorator/Scripts/Editor/Hierarchy/Info/ComponentIconInfo.cs:95)
HierarchyDecorator.HierarchyInfo:DrawInternal (UnityEngine.Rect,UnityEngine.GameObject,HierarchyDecorator.Settings) (at Library/PackageCache/com.wooshii.hierarchydecorator@7a0f71c371/HierarchyDecorator/Scripts/Editor/Hierarchy/Info/HierarchyInfo.cs:50)
HierarchyDecorator.HierarchyDrawer:Draw (UnityEngine.Rect,UnityEngine.GameObject,HierarchyDecorator.Settings) (at Library/PackageCache/com.wooshii.hierarchydecorator@7a0f71c371/HierarchyDecorator/Scripts/Editor/Hierarchy/HierarchyDrawer.cs:21)
HierarchyDecorator.HierarchyDecorator:OnHierarchyItem (int,UnityEngine.Rect) (at Library/PackageCache/com.wooshii.hierarchydecorator@7a0f71c371/HierarchyDecorator/Scripts/Editor/HierarchyDecorator.cs:117)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
WooshiiDev commented 1 year ago

Hi there Oliver,

Added a new hotfix version v0.9.1 to fix this. Let me know if there's any further issues with this.

I've also applied the changes to master and develop so if you're using either of those, the changes are ready 😄

Cheers ~ Wooshii

oliverbooth commented 1 year ago

I can confirm that that the issue is resolved, gj!

dylanilvento commented 1 year ago

Chiming in to say that this issue still seems to exist in v0.9.1. I'm currently on Unity 2022.3.6f1, which I upgraded from Unity 2021.3 due to this issue still existing in that version to see if an upgrade would alleviate it, and it did... temporarily. The other difference between my and OP's situation is that this error logs even when only one of the two components that share the same name (in different namespaces) is used in the scene's hierarchy, and the other one just exists in the project but is not actively used in the scene.

Appreciate a second look at this issue, and I'm otherwise loving the package!