Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Loading addressables (and scripts) between projects

Discussion in 'Addressables' started by Vosiz, Aug 26, 2023.

  1. Vosiz

    Vosiz

    Joined:
    Jul 14, 2020
    Posts:
    3
    Hi,

    I have some experince as c# programmer and unity developer. But this Addressable thingy is quite new to me and not understanding it correctly even after a month of try-errors...

    Maybe there is a another way how to achieve my goal, but I have chosen this way at the momeynt. Correct or point me in the right direction, I am opened to that.

    So. What I am trying to achieve is to share addressable bundles between 2 projects. Lets called one Primary and other Source. The concept is to build addressable bundles in Source (including scenes, prefabs, resource files and scripts), upload them to unity CDN/CCD and download them to Primary. All is fine until I download the scene and try to load it. It loads, but I am getting multiple warnings for missing Unknown scripts.

    I partially fixed this with serialization attribute, same addressables package and same Unity editor version. The scripts finally load themselves, but with no name and not starting. So I see the scene with prefabs, connected reaources and scripts (no name), but nothing is happening and still getting warnings at the start of scene.

    I tried to load assets first, the the scene, same thing, no change.

    Am I missing something crucial? Some tiny detail? Maybe the concept is false, but dont tell me if f.e. external company making you assets (like prefabs with scripts - guns for example), you dont share your code and they dont share theirs with you, it cannot be done via addressables and CDN.

    Any idea? I will try to share as much as I can. TY in progress. Unity 2022.3.0.

    upload_2023-8-26_2-2-57.png

    Example posted (PRIMARY): I downloaded Mainmenu scene with Jukebox, it is disabled and still not referencing the script called AudioController.

    upload_2023-8-26_2-6-12.png

    Example posted (SOURCE): This is how bundle looks like with main menu scene.
     
  2. Shii

    Shii

    Joined:
    Nov 23, 2014
    Posts:
    31
    I believe that addressables can't contain any scripts, but only script references. Your Primary project must contain all scripts so addressables loaded from Source can reference these scripts.
     
  3. Vosiz

    Vosiz

    Joined:
    Jul 14, 2020
    Posts:
    3
    TY for answer. The thing is primary project cannot have all source files (scripts, etc.) and secondary (Source) project, does not know anything about Primary (only small portion of shared info - 1 common scene to setup things).
    What I am trying to concept-prove is that external independent developers can contribute to bigger project and not have access to files as well developers of main project has not acces to their files.

    So I chose addressables as "communication protocol" and CDN as storage.

    Lets imagine it like this:
    Primary project is main menu, game managers and interactive map. Contributors (othe projects) are level developers of locations (or events, or anything else) on that map. Goal of primary project is to point to right location in CDN, download and load bundles -> run the event, change level... etc.
     
  4. Vosiz

    Vosiz

    Joined:
    Jul 14, 2020
    Posts:
    3
    EDIT:

    I ll try Scriptable objects if it is suitable solution for this scenario. Problem seems to be in Monobehavior.