Search Unity

Question ScriptableBuildPipeline - Putting scripts into separate bundle causes missing scripts

Discussion in 'Asset Bundles' started by OndrejP, Aug 10, 2021.

  1. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    I have a fully working bundle setup. A bundle named 'Common' with shared assets and then couple scene bundles which all depend on 'Common'.

    When I use 'CreateMonoScriptBundle' build task or I manually find all MonoBehaviour / ScriptableObject scripts in project+packages before starting bundle built. I get missing components at runtime. The interesting thing is that only some components are missing, not all MonoBehaviours defined in the project.

    The bundle dependency is correct - all bundles have dependency on 'Scripts' bundle and they are loaded in correct order ('Scripts' bundle first).

    @Ryanc_unity
    Any idea what could cause such behaviour?

    Edit:
    Could it be caused by moving some prefabs into different bundle through 'BundleExplictObjectLayout'? Does this work only for assets without dependencies (eg. scripts and shaders)?

    I moved prefabs into 'Common' bundle (from scene dependency) and moved scripts referenced by those prefabs into 'Scripts' bundle...which probably caused the issues because of some missing link? (all done through BundleExplictObjectLayout)
     
    Last edited: Aug 10, 2021
  2. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    332
    MonoScripts are different from MonoBehaviour/ScriptableObject
    So make sure you are only manually finding MonoScripts and putting those into the MonoScript bundle.

    > Could it be caused by moving some prefabs into different bundle through 'BundleExplictObjectLayout'? Does this work only for assets without dependencies (eg. scripts and shaders)?

    Yes, it was only designed for leaf objects.
     
    OndrejP likes this.