Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to publish optional features in packages with asmdef which require 3rd party asmdef

Discussion in 'Package Manager' started by MNNoxMortem, Aug 18, 2020.

  1. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    - Publisher A
    -- Package A
    --- A.asmdef

    - Publisher B
    -- Package B
    --- B.asmdef

    Enabling conditional features with a define is one thing

    Code (CSharp):
    1.  
    2. // In Package A
    3. #if PACKAGE_B
    4. #endif
    But how are we supposed to reference packageB.asmdef if it exists? One solution is to move the relevant code to a packageC

    - Publisher A
    -- Package C
    --- C.asmdef => B.asmdef

    but I am wondering if there is no better solution, e.g. a conditional reference.