Search Unity

Are all scripts in Assembly-CSharp?

Discussion in 'Editor & General Support' started by patrik-org, Jun 1, 2016.

  1. patrik-org

    patrik-org

    Joined:
    Sep 10, 2012
    Posts:
    100
    Will the non-editor scripts always be inside an assembly called "Assembly-CSharp" regardless of platform? I ask because I need to use reflection to find all derived types of a certain type and because of performance reasons I don't want to do it on all the loaded assemblies. So is it enough to check for types in the assembly called "Assembly-CSharp"?
     
  2. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    Depends if they reside inside Plugins, editor or a regular asset folder.

    You can find all the generated dll's inside Library/ScriptAssembles/*
     
  3. patrik-org

    patrik-org

    Joined:
    Sep 10, 2012
    Posts:
    100
    Is there a list of the different assemblies generated? And will they be named the same regardless of platform?
     
  4. crispybeans

    crispybeans

    Joined:
    Apr 13, 2015
    Posts:
    210
    The dlls are exactly the same and reused between diffirent platforms - They will get loaded in a certain order being the Plugins and game ones first. There are seperate assemblies for unity script which as well which I forget to mention.
     
    Last edited: Jun 2, 2016
  5. patrik-org

    patrik-org

    Joined:
    Sep 10, 2012
    Posts:
    100
    Thanks.
     
  6. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    There's up to four assemblies generated per language. It's the default one (assembly-csharp), the editor one, the plugins one, and the plugins editor one.

    There's an identical set for UnityScript, and one for Boo if you for some reason have some of those scripts still around.

    Both the Editor and the Plugin Editor assemblies will be stripped from your final build, but the plugins one will stay. That has a consequence for you; if you're giving these scripts to other people, and they might put it in their plugins folder (as you do with plugins), they might subclass your scripts both in their plugins assembly, their default assembly, and their UnityScript default assembly.

    If you're just using this yourself, you're good, though.
     
  7. patrik-org

    patrik-org

    Joined:
    Sep 10, 2012
    Posts:
    100
    It will be in a published asset where users will be able to subclass my scripts. Right now I'm checking all the loaded assemblies and if the name starts with "Assembly-" - which I assume would also capture the first pass assemblies (in the Plugins and Standard Assets folder). Would be helpful to know how the different assemblies are named so I can capture them all.