Version: 2021.2
LanguageEnglish
  • C#

CompilationPipeline.RequestScriptCompilation

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void RequestScriptCompilation();

Declaration

public static void RequestScriptCompilation(Compilation.RequestScriptCompilationOptions options);

Parameters

options Optional parameter to specify whether the Editor should clear the build cache before compilation.

Description

Allows you to request that the Editor recompile scripts in the project.

When you call this method, the Unity Editor checks whether there have been any changes to scripts, or to settings affecting script compilation, and recompiles those scripts which require it. After the compilation, if the compilation was successful, the Unity Editor reloads all assemblies. If you want to force recompilation of all scripts, even if there are no changes, you can pass RequestScriptCompilationOptions.CleanBuildCache for the options parameter. You may want to force recompilation of all scripts in the following situations: - If you have a successful compilation, but want to see all compiler warnings again. - If you have a setup where the compilation pipeline takes input from files that Unity cannot track (this is possible in rare circumstances when using response files). - If there is a bug or suspected bug in the compilation pipeline causing it to not pick up changes.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961