Search Unity

Cloud Build: Change Scripting Define Symbols during Prebuild script doesn't affect Editor script?

Discussion in 'Unity Build Automation' started by cdytoby, Jul 9, 2019.

  1. cdytoby

    cdytoby

    Joined:
    Nov 19, 2014
    Posts:
    181
    Unity 2018.4 LTS

    I have `PlayerSettings.SetScriptingDefineSymbolsForGroup` in Prebuild scrpt, and it should set the define symbols correctly, but after that, in the class derived from IPreprocessBuildWithReport, the define symbol is not correctly set, and executed something else.

    Is this a bug or it's expected?

    Let me explain why we need this: there is a feature that Unity don't have: selective folder compile. I want some of the folders not included with a build, those folders are not just scripts, they also include plugin folders and "Resources" folders. In order to achieve this, I control the define symbol in script, and change the define symbols as well as some other settings in pre build process, the relative folders are renamed to "Folder~" in order to be excluded. Which worked well in Unity 2017, but I noticed a change in Unity 2018.

    It seems that Unity 2018, cloud build post build script no longer executed "immediately", but after a frame or after a recompile. Which lead to problem because before post build script is executed, some UNITY_EDITOR area code will be compiled which could lead to error.

    I'm aware of the order of the cloud build: Cloud Build Pre Processor Script (1) ->
    IPreprocessBuildWithReport (2) -> IPostprocessBuildWithReport (3) -> Cloud Build Post Processor Script (4).
    For this reason, I have to move change folder name process from step 4 into step 3. But now the problem is, the define symbols changed in step 1 doesn't affect the script in step 2, despite of the method "PlayerSettings.GetScriptingDefineSymbolsForGroup" shows the correct result in step 2.
     
    JoshW_3 and alpatabeyy like this.