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. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Feature Request Load a graph from an AssetBundle + code in external assembly dynamically

Discussion in 'Visual Scripting' started by bdovaz, Jan 12, 2022.

  1. bdovaz


    Dec 10, 2011
    @jeanedouard_unity @ericb_unity

    My use case, I know, is complex.

    Project A:

    1. It contains a scene with a graph referencing code that is in an asmdef.
    2. Publishes an AssetBundle of the scene.
    3. Copies the dll associated to the asmdef.

    Project B:

    1. Loads the dll dynamically.
    2. Loads the AssetBundle, extract the scene from it and load it.

    The problem I encounter is that the Visual Scripting package does not support this use case. In the constructor of the RuntimeCodebase class, it accesses all the assemblies loaded at that moment (AppDomain.CurrentDomain.GetAssemblies()) but as my assembly is loaded later, it is already late and it makes that the references that correspond to code related to the VisualScripting package (as for example variables or graphs) do not load correctly with an error: [Deserialization] Unable to find type: {type}.

    That class exposes "assemblies" and "types" properties as IEnumerable<> but when looking at the code I see that it is a List<> so I have been able to do the workaround of casting and manually re-execute the code of that constructor but only for my assembly.

    I would like that you support this case, as minimum it would be necessary to expose a new method in RuntimeCodebase that receives an instance of an Assembly and executes the code of the constructor for that assembly.

    I've a repro project with the two projects with the minimum code possible if you want to check it out.