Search Unity

Add references (depedencies) to custom package

Discussion in 'Package Manager' started by Boolable, Apr 30, 2020.

  1. Boolable

    Boolable

    Joined:
    Jun 28, 2015
    Posts:
    20
    Hi!

    I'm creating a custom package. In my package, I use `UIElements` and `PanelRenderer`. But when I try to add usings, I got some errors:
    Code (CSharp):
    1.  
    2. using Unity.UIElements.Runtime;
    Error:
    Code (CSharp):
    1. error CS0234: The type or namespace name 'UIElements' does not exist in the namespace 'Unity' (are you missing an assembly reference?)
    2. error CS0246: The type or namespace name 'PanelRenderer' could not be found (are you missing a using directive or an assembly reference?)
    When I try to add dependencies on my .asmdef file, I cannot find UIElements:

    Why is this list so empty? How can I fill it with other assemblies?

    Another thing is that I use NewtonSoft.Json on my custom package. How should I include NewtonSoft.Json to ensure I will be available when I import my custom package (without to have to import NewtowSoft.Json manually after having imported my custom package in my game)?

    In my custom package "package.json" file, there is a "dependencies" property (as seen in the official doc), but when I add entries to this "dependencies" property, nothing happend in my projet, like if this property was ignored.

    Finally, imagine I want to use assets from Unity Assets Store in my custom package, what is the good way to include them on my custom package (to make them available on the game project when I import my custom package)?