Search Unity

Dealing with GUID when using automatic generation of assemblies instead of script for package export

Discussion in 'Editor & General Support' started by Florian-Nouviale, May 15, 2019.

  1. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    54
    Hi,

    I've tried once again to get a unitypackage automatically created through our coutinuous integration system with assembly files instead of script files, so that we can distribute our stuff and hide the code a bit.

    I'm basically trying to recreate what the UnityEditor already does in some sense but I didn't find anything automatic like what I need (If I missed a feature, please tell me !)

    The road so far :

    I create a class with a static constructor and [InitializeOnLoad] that can handle command line arguments where the user can say "please, replace this asmdef file with the corresponding assembly (.dll) file"

    After some trial and error, what this class does for now is this (in case it may be useful for someone):

    1. Get the asmdef file
    2. Get the corresponding assembly file using CompilationPipeline.GetAssemblies() (hidden somewhere in the Library/ScriptAssemblies folder)
    3. Move the source .cs files outside the asset folder using the Assembly.sourceFiles property
    4. Move the assembly file in the same folder as the asmdef file
    5. Move the asmdef file ourside the asset folder
    6. Rename the asmdef.meta file to mydll.dll.meta to keep the guid constant
    So far so good. I am only facing one last problem.
    In my original project, I created prefabs that are using some of the scripts that are now replaced by an assembly

    I have no idea how to tell my prefabs to use the component inside of a specific assembly file, instead of the script file they had. I understand that the guid parameter in the prefab file is the assembly guid, but how can I get the component fileID? Is there an easy way to update the prefabs references or do I need to edit them as text files ?
     
  2. jmercier-ganady_artefacto

    jmercier-ganady_artefacto

    Joined:
    Nov 23, 2015
    Posts:
    1