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 - "Attempted to register a component that already exists." when using same script name, but different namespace #81

Open SiarheiPilat opened 11 months ago

SiarheiPilat commented 11 months ago

Current Unity version used 2022.3.4f1

Describe the bug Error is shown when you have two scripts with the same name, but different namespace, for example NamespaceA.ScriptName and NamespaceB.ScriptName and two files: ScriptName.cs and ScriptName.cs in different folders.

To Reproduce (If applicable) Follow these steps to reproduce:

  1. Create two folders: Assets/FolderA and Assets/FolderB
  2. Create two files: Assets/FolderA/TestScript.cs and Assets/FolderB/TestScript.cs
  3. Code for Assets/FolderA/TestScript.cs:
    namespace NamespaceA
    {
    public class TestScript : MonoBehaviour { }
    }
  4. Code for Assets/FolderB/TestScript.cs:
    namespace NamespaceB
    {
    public class TestScript : MonoBehaviour { }
    }
  5. Work with the files by adding them to different game objects by dragging and dropping to the inspector, the error will appear.
WooshiiDev commented 3 months ago

Hey Siarhei,

with the current changes that are on the develop branch this may be fixed.

Not sure if this is still a use case problem for you, but I've set up the same situation on my side and can't trigger it.