Version: 2021.3

CompilationPipeline.RequestScriptCompilation

切换到手册
public static void RequestScriptCompilation ();
public static void RequestScriptCompilation (Compilation.RequestScriptCompilationOptions options);

参数

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

描述

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