Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Creating packages with assembly files sintead of source files

Discussion in 'Package Manager' started by Florian-Nouviale, Dec 13, 2018.

  1. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    22
    Hi,
    If I read correctly, custom package creation is not still fully officially supported but I was wondering if it will be possible, when creating a package for the package manager, to transform asmdef files to their assembly equivalent automatically ?

    What I have tested so far, is copying the assembly file that unity creates from the .asmdef in the same folder as the asmdef it was created from, removing the script files.

    The result is that also unity recognizes some classes in the assembly, it refuses to add them on an object through the editor (like in dragging them brings the error "Can't add script component xxx because the script class cannot be found....", or they just don't appear in the Add Component menu on the game objects)
    However, adding them via scripting (AddComponent) works
     
  2. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    289
    Hi @Florian-Nouviale,

    I'm sorry, I don't understand your question :(. Can you reformulate, please?

    Pascal
     
  3. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    22
    I will try :) English is not my main language.

    Basically, and if I understand correctly, when we create a package, it contains the files we selected as they are in the project, including scripts.
    Meaning that those scripts can be opened by any user of the package.
    What I would like to do, is that when we create the package, the script files that are tied to an asmdef file are removed/replaced by the assembly that unity internally creates for theses scripts.

    I tried to do that myself on continuous integration but the behaviours in the assembly files that unity creates somehow cannot be added in a scene through the unity editor
     
  4. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    289
    Ok. I think I understand what you would like to do. Do you want to ship the compiled assembly (.dll) in your package, not the source scripts? I'm I correct?
     
  5. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    22
    Yes that's it :)
     
  6. okcompute_unity

    okcompute_unity

    Unity Technologies

    Joined:
    Jan 16, 2017
    Posts:
    289
    Ok. We don't have any automated process for this at the moment. And our current plan is to ship our package as sources. A very limited set of packages coming from Unity will be pre-compiled. We want people to see and possibly change the code for fixing bugs or to adapt to their needs.

    What you can possibly do, is to embed your package with source code in your project. Take the generated assembly DLL located in the
    Library/ScriptAssemblies
    folder and share a package with only this DLL. As I said, we don't provide any tooling for the moment to support this kind of workflow though. You'll have to implement it for your needs.

    Regards,

    Pascal
     
  7. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    22
    Yes that's what I tried to do but it seems the monobehaviours are not correctly recognized by the editor when coming from one of these assemblies. I can add them thought scripting but not drag/drop them on a game object. That's where the error "Can't add script component xxx because the script class cannot be found...." appears

    Regards
     
  8. HaraldNielsen

    HaraldNielsen

    Unity Technologies

    Joined:
    Jun 8, 2016
    Posts:
    30
    Hi @Florian-Nouviale
    When you add Script Components in the you work on the asset. Since you dont have that asset you can't do that.
    You can add it in code, but usually as a user it's not really optimal, because you would need to add some Editor code that handles this for you.

    There's a couple of positive things letting Unity compile for you.
    Defines and References can change based on build target and project settings, and asmdef's will automatically get those included.
    You more explicitly can handle references.
    Hope it gives you some answers
     
  9. lukaszunity

    lukaszunity

    Unity Technologies

    Joined:
    Jun 11, 2014
    Posts:
    406
    Please report a bug on this through the Unity bug reporter and we will investigate the issue.
     
  10. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    22
    Will do, thanks :)