Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug Problems importing DLL when inheriting from classes in another DLL.

Discussion in 'Editor & General Support' started by gtzpower, May 18, 2021.

  1. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    315
    I am running into some problems (in Unity 2020.3.4) where importing a DLL does not pickup the MonoBehaviours that are inheriting from a class in another DLL, under certain conditions.

    Lets say Base.dll contains a class named BaseBehaviour and it inherits MonoBehaviour. This DLL lives in Plugins/Base/Base.dll.

    I also have a Derived.dll that contains a class named DerivedBehaviour which inherits BaseBehaviour. This DLL lives in Plugins/Derived/Derived.dll.

    Here's the kicker. If there is also a Base.Editor.dll in the Plugins/Base folder (whose only selected platform is Editor under import settings), the three DLLs cannot be imported at the same time. If you select all 3 and reimport, the DerivedBehaviour will not appear. I have to manually reimport the Derived.dll on its own to get the class to show up. I can import Derived.dll and Base.dll together, and I can import Derived.dll and Base.Editor.dll together, just not all 3.

    If I move Derived.dll into the Plugins/Base folder, I can import all 3 DLLs at the same time and it works fine.

    Other than moving all of these DLLs into one folder (please no) is there any way to get Unity to import the derived classes reliably when the base DLLs and their editor-only counterparts are also importing?
     
    Last edited: May 18, 2021
  2. gtzpower

    gtzpower

    Joined:
    Jan 23, 2011
    Posts:
    315
    I made a small repro case to submit a bug report, and I discovered that it has nothing to do with the Base.Editor.dll being an editor only DLL. Simply importing 2 DLLs from the Base folder along with the Derived.dll causes the issue.

    Submitted bug report (Case 1337707). I am also attaching the repro case here in case anyone wants to mess around with it.
     

    Attached Files: