Search Unity

Question BuildPlayerScripts step in SBP

Discussion in 'Asset Bundles' started by liortal, Jul 20, 2021.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I am looking at the general build log (json) when working with SBP, the longest step is BuildPlayerScripts.

    I was wondering what this step is, and why are scripts being compiled as part of an asset bundle build?
    Is there any way to avoid this step or to optimize it ?
     
  2. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    304
    No, you can't optimize it and it's necessary.
    Scripts are built for target platform and serialization format is determined from that.

    It's not just serialization format, but also references. There might be #ifdefs in scripts, which could change what assets are referenced and what fields are serialized, that's why it's needed.

    If you have a tons of 3rd party scripts in the project, I'd suggest to turn them into DLLs (where possible).
    We have a LOT of scripts in project and compilation usually takes about 3s, which is okay IMO.