unity-builder icon indicating copy to clipboard operation
unity-builder copied to clipboard

importing a package before building

Open megetron opened this issue 3 years ago • 3 comments

what i'm trying to achieve is the ability to import external package before building the unity project.

tried to do this (without sucess):

      - name: Import SDK
        uses: game-ci/unity-test-runner@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
        with:
          githubToken: ${{ secrets.GITHUB_TOKEN }}
          customParameters: -quit -batchmode -importPackage mypackage.unitypackage

can one get the unity executable path to run some unity commands such as:

      - name: Import SDK
        run: /opt/unity/Editor/Unity -importPackage mypackage.unitypackage

megetron avatar Jan 02 '22 18:01 megetron

Builds should generally be deterministic. The imported package should be defined in your dependencies (and if need be used conditionally). I'd consider importing a package during CI time bad practice.

That said, I do not know your exact use case. Perhaps it's somehow warranted?

webbertakken avatar Jan 13 '22 11:01 webbertakken

yes agree. usually it is a bad practice.

with that being said, the use case is having a unity project that its main goal is to test a unitypackage (sdk) file.

so actually each version of a unitypackage will be imported to this project and some tests will be executed with this imported package.

so now, when you can import in CI/CD, then you can execute tests versus multiple packages in a matrix manner.

megetron avatar Jan 13 '22 13:01 megetron

Have you tried a custom build method with this: https://docs.unity3d.com/ScriptReference/AssetDatabase.ImportPackage.html

AndrewKahr avatar Mar 04 '23 23:03 AndrewKahr