Search Unity

Change asmdef dependencies based on Unity version

Discussion in 'Editor & General Support' started by Deadcow_, May 27, 2019.

  1. Deadcow_

    Deadcow_

    Joined:
    Mar 13, 2014
    Posts:
    135
    So, now with Unity 2019.1 and 2019.2 Unity.Timeline and Unity.ugui were introduced and my public library is require them to be listed in asmdef references.
    I'd like to keep backward compatibility and also automate extra step of assigning asmdef references on lib import.
    At first I though, why not to check unity version on editor start and generate asmdef based on that (as plain text file) with some editor script.
    But if my lib will have compilation errors this script won't run in the first place :rolleyes:
    Well so to my question: is there a way to automatically add required dependencies or change/substitute asmdef based on Unity version?
     
  2. Deadcow_

    Deadcow_

    Joined:
    Mar 13, 2014
    Posts:
    135
    I've got one awkward idea in mind to solve this. All lib scripts may be in a nested folder with asmdef and single script outside of this folder (thereby not in asmdef generated assembly) will handle asmdef generation. This way if the whole library will be broken because of asmdef, this single script will be compiled anyway

    I'd like to hear some better idea, I don't want to mess up my folder hierarchy and spread my library across different assemblies :oops: