Search Unity

Question Can not reference to script when loading remote catalog

Discussion in 'Addressables' started by rangolee302, Jul 4, 2022.

  1. rangolee302

    rangolee302

    Joined:
    Feb 1, 2018
    Posts:
    22
    So I try to load a remote catalog by LoadContentCatalogAsync() and the flow I am using is:
    1. InitializeAsync()
    2. LoadContentCatalogAsync()
    3. LoadResourceLocationsAsync()
    4. DownloadDependenciesAsync()
    5. LoadAssetsAsync()
    6. LoadSceneAsync()
    I try to load a scene from another project and It has successfully loaded. But the script attached to gameObjects in that scene is missing. The warning is "The referenced script on this Behaviour is missing!". I tried the fix here (https://forum.unity.com/threads/getting-the-referenced-script-unknown-on-this-behaviour-is-missing-when-loading-adressable.1157132/) but it is not working. Anyone have any ideas?

    P.S the result files built from another project
    upload_2022-7-5_9-51-7.png
     
    Last edited: Jul 5, 2022
  2. rangolee302

    rangolee302

    Joined:
    Feb 1, 2018
    Posts:
    22
    Correct me if i am wrong, I saw it from another post that the project A that loads a catalog from another project B has to know about all the scripts. So I guess I have to import every scripts from B to A.
    P.S I am using IL2CPP as scripting back-end


     
  3. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Hello, yeah that's the case, unfortunately. The base project's player will need to be aware of all the scripts you're trying to use. In general, for multi-project workflows, try and keep the ancillary to as much "content only" stuff as you can. But, in cases where that's not possible, you'll have to make sure the base project knows how to get those scripts.

    You might could ship dlls compiled with project B into project A, load them, and then load your Addressables. I haven't actually done that before, so take that with a grain of salt, but I think that could work. But, it may just be easier to have copies of your scripts, depending on your project.
     
    rangolee302 likes this.