Search Unity

Preprocessor directives

Discussion in 'Package Manager' started by Deleted User, Oct 8, 2018.

  1. Deleted User

    Deleted User

    Guest

    Since there is now the option of disabling all the modules you do not need in your project, there might still be assets that try to be as modular as they are. For that reason, preprocessor directives would be necessary to compile features out that are not even activated. Is there a list of these?
     
    Peter77 likes this.
  2. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    756
    Hi @Alexees,

    This is something that we are working on. I cannot give you a strong ETA though. Not for 2018.3. Hopefully 2019.1.

    Regards,

    Pascal
     
    Last edited: Oct 10, 2018
    AVOlight and Stormy102 like this.
  3. Deleted User

    Deleted User

    Guest

  4. Deleted User

    Deleted User

    Guest

  5. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    756
    Hi @Alexees ,

    The feature was implemented in the Assembly Definition settings window. Look for the Version Defines section in the Scripting user manual.

    Regards,

    Pascal
     
  6. Deleted User

    Deleted User

    Guest

    @okcompute_unity That's great to hear. How does that work against something like the ARFoundation package. It's optional. I'd like to create assets optional in regards to this package. If available, make mine available.
     
  7. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    756
    The feature only works within scripts. Did I get your question correctly?
     
  8. Deleted User

    Deleted User

    Guest

    I try to rephrase and we'll see if your answer is still no ;)
    Let's say I create an asset that has optional AR features and therefore partially relies on the ARFoundation package. Now two customers download that package, one wants to use it, the other does not, hence, one has the ARFoundation package installed while the other has not. The AR features should be compiled or stripped respectively.
    How do I depend an ASMDEF on the existence of a package?
    The closest that I've seen is basing it on "define constraints" but for that, ARFoundation would need to set a directive I I need to know it (That's the list I was talking about in my initial comment).
    Version Defines seems to expect active packages or modules to even be selectable from the dropdown and only checks against their version but not against there existence.

    Was that more clear?
     
  9. samuelb_unity

    samuelb_unity

    Unity Technologies

    Joined:
    Nov 13, 2017
    Posts:
    151
    Hi @Alexees,

    It seems Version Defines are the way to go. You are right that you'll need a dependency in your project in order for the dropdown list to be populated but from there you can make the dependency optional by entering the lowest-known version number for that package so that the expression
    has the outcome
    for example. In fact, you could try putting a version of
    but I'm not sure if this is supported.