Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Reuse same assets in multiple packages

Discussion in 'Package Manager' started by evotionce, May 5, 2020.

  1. evotionce

    evotionce

    Joined:
    Mar 22, 2018
    Posts:
    3
    Hello,

    I was looking into the possibility to use the package manager as a module system and came across some questions/comments that I would like to discuss with you.

    My goal is to create packages with prefabs that are out of the box consumable in a scene. That means all related assets (Texture, Materials, ...) would also need to be included in the package.
    Lets assume we now have multiple packages with unique prefabs, but they should use the same subcomponents like Textures, Materials, ...).

    1. Would this structure make sense? If yes, what would be the best way to achieve this?
    My approach was to export my common subcomponents with "Export package ..." and import them into my packages. When multiple packages are used in one project I get for all of them the following import error:
    GUID ... for asset ... conflicts with ...

    For me this sounds right about perfect, because the subcomponents that are actually the same seem to have the same guid and are only imported once. All my prefabs are still working because it's subcomponents are bound via guids.
    Still this error made me wonder if I am on the right track, and it would be quite annoying to have hundreds of import errors every time.

    The structure I envision:
    <New Project>
    ├── Assets
    │ ├── Scene (Prefab 1 and Prefab 2 are used)
    ├── Packages
    │ ├── Package 1
    │ │ └── Prefab 1 (using Material 1 and Texture 1)
    │ │ └── Material 1
    │ │ └── Texture 1
    │ └── Package 2
    │ └── Prefab 2 (using same Material 1)
    │ │ └── Material 1
    └── ...

    FYI: Using github to store the packages and import into other projects.

    Many thanks :)