#Unity package dependencies

1 messages · Page 1 of 1 (latest)

copper geyser
#

heya, i'm trying to create a custom package for some code that i'm turning into modules, so i can update the package and distribute the changes to each project i use the code in

i use the amazing MyBox package pretty heavily throughout my own package for some custom editor attributes (the licence allows redistribution), but i'm having trouble figuring out how exactly i should set my package up so that MyBox is a dependency

i've tried leaving the dependency code outside of the package entirely, but my IDE throws errors at me immediately (which is to be expected, i guess) since it doesn't know what the using line refers to, so i assume that i can't have the code outside of the package and have it assemble nicely when imported to the editor

so the option seems to be to copy and paste the entirety of MyBox and embed it inside my new package, but this runs into a separate issue - i already use MyBox inside of the project itself, and importing just the code itself along with my package creates ambiguous references in non-package code

have i added the code to the package incorrectly (i did not copy MyBox's package data, only the scripts), or do i simply need to rename every namespace within it to something else? or am i missing a much simpler option here? it's not currently feasible to remove it as a dependency

thanks in advance :3

dense crown
#

Easiest solution, is to MOVE instead of copy MyBox package data into your package. The conflict exists because there's two copies of the same things that unity sees at the same time. It's seeing double and doesn't know which one it's supposed to use.

#

However, unity tends to be a bit fussy sometimes, so I'd recommend first moving it out of your assets folder, letting your project recompile (and fail) and then moving it into the package. If there's a conflict already, even removing the original package won't resolve the issue, because unity assigns a different GUID to the duplicate and doesn't restore it to the original's guid it even after the original is gone. Which still breaks assembly references. This might not apply if you don't use assemblies in your code

copper geyser
#

it turns out that i had just never assigned the assembly references in the first place - didnt read the docs thoroughly