Search Unity

Custom Package depends on Zenject

Discussion in 'Package Manager' started by JeromeGodboutAmotus, May 21, 2021.

  1. JeromeGodboutAmotus

    JeromeGodboutAmotus

    Joined:
    Apr 24, 2020
    Posts:
    40
    Hi,
    I'm trying to make a custom package that rely on the Zenject. Zenject 9.2.0 doesn't seem to play well with the package manager and this give me a hard time to make this work:
    • Zenject doesn't show up after install into the package manager.
    • Cannot put a dependencies on it.
    • Install itself into the /Plugins/Zenject folder
    If I install the Zenject into the solution and my class work just fine into the Asset script. When I try to put my script into my custom file, the Zenject class (MonoInstaller and DiContainer) are not found anymore.

    I did try to move the Zenject folder into the package:
    /Plugins/Zenject
    But that did not worked.

    I though I could make a wrapper custom package and depends on it.
    • ZenjectWrapper Package (/Plugins/Zenject)
    • MyCustomPackage (depends on ZenjectWrapper)
    But the class inside the custom package still cannot access the Zenject classes.

    Using those packages, I can move the class back into the Unity project and the classes are now found properly from the custom packages. How does the /Plugins/ folder exposed into the custom packages exactly?

    If anybody has a clue on how to achieve that script into a custom package that would be welcome.

    Personal opinion ahead: That packages systems is painful at best, here is my list of things that doesn't make sense to me and point to a bad architecture for that part:
    • why is the package folders not mirror from inside the project?!
    • no support for the link.xml
    • dependencies that cannot use git into packages dependencies
    • Injecting Plugins inside custom packages doesn't seem to be inside the same context (my issue above)
    • Packages manager view, why so many category that I cannot see all install at once, those category should be filter instead.
    • Package git authentication or the lack of it with a CI system is painful to automate. I have to make all my custom package by ssh and install the key on the system and also make sure the CI ignore the known host (or generate the fingerprint for that host).
    • The packages manager NPM without authentication again... That could have been fun with artifactory but no... another feature that fall way short.
    All in all the packages into unity feel like a soup of half bake features that leave a very sour taste.
     
  2. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,052
    maximeb_unity likes this.
  3. JeromeGodboutAmotus

    JeromeGodboutAmotus

    Joined:
    Apr 24, 2020
    Posts:
    40
    I did wrap the Zenject (extendject) package into a custom package and depends on my wrapper package instead, I was also having some issue with the asmdef, I forgot that it did needed reference to Zenject into the runtime .asmdef of my packages at first.

    Thanks for the openupm.com link, I will check it out, good to known that there might be something cleaner then what I did. If I can ditch my wrapper the merrier I will be.

    The whole Unity packages (doc and implementation) need some serious overhaul, it's a lot of must known and hidden features and the doc example are way too simple to cover any real world usage.
     
    bdovaz likes this.