Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Feedback Installed packages should create a unique Scripting Define Symbol

Discussion in 'Package Manager' started by Greyborn, Oct 26, 2019.

  1. Greyborn

    Greyborn

    Joined:
    May 26, 2016
    Posts:
    44
    Feature suggestion - it would be nice if installed packages created a Scripting Define Symbol (found in Project Settings/Player/Other Settings). This would really help 3rd party editor extensions/tools authors when wanting to add optional support for installed packages in their tools.

    In our use case, we modified a popular project search tool to be able to filter by what was/was not an Addressable. Unfortunately this code will only compile if the Addressables package is installed in the project. This prevents the author from including this feature in the tool because the tool will not compile with our change if their customer's projects do not use Addressables.

    Thanks for listening! If we missed something, please let us know!
     
    Michael-Ryan likes this.
  2. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    607
    Hi @Greyborn,

    The feature you are looking for is called Version Defines. Look for it in the Scripting manual. More precisely, the Assembly Definitions introduction section. I will admit, we are not doing a good job to promote this feature! But it basically covers your use case.

    Let me give you more detail on why we chose this approach. We cannot automatically generate symbols for all packages in your project. It could grow to be a large set of symbols (and possibly use lots of memory space, slow down build, etc). This is true especially if we need to include the *version* of the package in the symbol. So instead, we propose a solution where you create the symbols that you want to be targeted for your use case if the package is present.

    Regards,

    Pascal
     
  3. Greyborn

    Greyborn

    Joined:
    May 26, 2016
    Posts:
    44
    Thanks for pointing us to this. It looks like a bulk of this functionality comes online with 2019 (we are on 2018 LTS for our project). Hopefully third party tools creators can start to use this in the far future if they don't need to support older Unity versions that currently support the package system.