Search Unity

Exclude C# Scripts from Compilation

Discussion in 'Editor & General Support' started by Manato, Dec 30, 2017.

  1. Manato

    Manato

    Joined:
    Jun 11, 2015
    Posts:
    28
    Hi,
    Is there a way that some c# scripts do not compile (editor not reload) after modify when I switch back to the unity editor?

    I tried to put these in the folder WebPlayerTemplates but the files wouldn't be recognize as CS anymore (i.e. haven't the benefits of code completion with my editor).
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Why do you want that behaviour?
     
  3. Manato

    Manato

    Joined:
    Jun 11, 2015
    Posts:
    28
    I want to compile at runtime. There are times I have to rewrite one line of code to test a behaviour of a function. Of couse, switching back to unity will reload the assets. If I sum it up, I wast hours only waiting.
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,157
    You can modify a script while the editor is in play mode and it'll recompile and start using the new modification of it.
     
  5. Manato

    Manato

    Joined:
    Jun 11, 2015
    Posts:
    28
    Yes, I know, but it will reload the assets and not only compile the one script I changed. And still, I have to wait for completion.
     
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sometimes I just use [ExecuteInEditMode] and bang out a quick script to test so I don't have to keep entering play mode. If compilation times are an issue, use 2017.3's assembly feature.
     
  7. Manato

    Manato

    Joined:
    Jun 11, 2015
    Posts:
    28
    [ExecuteInEditMode] is really useful, but for gamplay code like transformation etc, it's not the right thing.

    Right, the new Version is out. Thank you, I will check it out.