Search Unity

Custom Editor For Protected Monobehaviour Inside Sub Assembly

Discussion in 'Editor & General Support' started by CharlieBudd, Jul 5, 2020.

  1. CharlieBudd

    CharlieBudd

    Joined:
    Jul 24, 2017
    Posts:
    17
    I have an assembly (defined by an assembly definition file) containing a subsystem of my project. One of the monobehaviors within the assembly is tagged as internal so I can only access it from within the assembly. All good so far.

    But this internal component has a custom inspector which is in a different sub assembly (required to avoid UnityEditor references in my runtime assembly). This prevents me from accessing the monobehavior type for use in the CustomEditor attribute.

    I suppose a work around would be to include all the editor code associated with sub assemblies in the sub assembly itself but with pre-processor definitions to prevent failed builds. But it would be nice to avoid this by allowing the CustomEditor attribute to optionally take a string of the class name instead of using typeof().