ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D
MIT License
2.53k stars 366 forks source link

Add support for Unity Package Manager #540

Open simeonradivoev opened 5 years ago

simeonradivoev commented 5 years ago

Just by adding a package.json with the details as described here could allow zenject to be put in the new packages folder. This would allow the source code to not get in the way of projects.

Ideally a sub module with just the zenject code would go along way with frequent updates, especially when unity start supporting custom git manifest with their package manager UI.

MeikelLP commented 5 years ago

I did some research on the topic and it seems that it is not as easy as adding a simple package.json file.

UPM does not support subdirectories at the moment and this requires us to have the exported project at the root directory (currently for unity it is located under UnityProject/Assets/Plugins/Zenject). UPM, on the other hand, supports branches using a #branch suffix.

I did get it to work doing the following:

This is the "local file" way of doing. This is not fully equal to the "git" way of doing. These changes are significantly modifying the project in whole and should only be done in cooperation with @svermeulen At this point I offer my help with this topic as this is a super important feature (for me at least).

Everything I know comes from https://forum.unity.com/threads/git-support-on-package-manager.573673/

simeonradivoev commented 5 years ago

Hopefully, the will add an option for subdirectories when they officially release the git support for UPM. Then just moving the UnityProject/Assets/Plugins/Zenject/OptionalExtras folder up or moving assembly definition and package.json to the UnityProject/Assets/Plugins/Zenject/Source folder should be required.

cpetry commented 5 years ago

Could you please add the package.json file? I would like to use it as @MeikelLP mentioned. Then at least this step is done.

Hermesiss commented 5 years ago

If you approve I can integrate simple Travis Ci script that pushes required files to separate branch so you can use it with UPM: https://github.com/Hermesiss/unity-package-manager-ci

MeikelLP commented 5 years ago

I made a fork which seems to work. I can at least call Zenject code from within my code (after referencing the .asmdef file).

You can use it like this:

"com.modesttree.zenject": "https://github.com/MeikelLP/Zenject.git#upm",