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. Dismiss Notice

Can I test the compilation of C# code in "Player" mode, without doing a full project build

Discussion in 'Editor & General Support' started by mhgamework, Sep 9, 2020.

  1. mhgamework

    mhgamework

    Joined:
    Dec 13, 2014
    Posts:
    13
    I currently have a working CI setup with Unity, but i am looking for a fast way to check if there are any C# compile errors before actually doing a full build of the project. I want to use this check to quickly report on the status of a broken commit on a master/production branch.

    Currently, the only way i have found to do this is by launching a full build of the project. In case there is a compiler error, this fails fast, but in the other case i have to wait the full time of the build before the unity commandline runner returns the success result.

    I would like to have a way to just compile the C# code with the correct #ifdefs for building a player, so i can quickly see if there are compiler errors in the code.

    Is there a way i can do this?
     
  2. sameng

    sameng

    Joined:
    Oct 1, 2014
    Posts:
    172
    did you ever find a solution?

    I'd like to be able to test for build compilation errors as well -- without kicking off an entire build.
     
  3. Nick-Nexefy

    Nick-Nexefy

    Joined:
    Mar 20, 2019
    Posts:
    6
    One way I've done it in the past is if your project is using addressables is to build the addressables. Its typically has been shorter than doing a build but if you have a lot assets and aren't building regularly this could take awhile.