Search Unity

Preprocessing directives to avoid code containing addressables until package is installed?

Discussion in 'Addressables' started by senfield, May 2, 2019.

  1. senfield

    senfield

    Joined:
    Apr 1, 2019
    Posts:
    31
    I was wondering if there are preprocessing directives I could use or some other way of avoiding scripting errors related to the addressables package not being installed?
    In editor mode, I kind of want to make a tool that I can bring into a project and use to tell addressables to install and then tell it to create the exact initial addressables group configuration I'll be needing.
    But of course the script that creates the initial group configuration needs addressables as a dependency, so it creates a compiler error if the package is not yet installed.
    So I can't also have a script that installs the package because the error in the other script will cause all the scripts not to run in the editor.
    So basically, I want to make unity skip compiling my group configuration script until the addressables package finishes installing.
     
  2. M_R

    M_R

    Joined:
    Apr 15, 2015
    Posts:
    559
    make your tool a package, then add
    com.unity.addressables
    to its dependencies.
     
    unity_bill and senfield like this.