RequestScriptCompilation
Allows you to request that the Editor recompile scripts in the project.
Read time 2 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEditor.Compilation
- Assembly: UnityEditor.CoreModule
RequestScriptCompilation()
Allows you to request that the Editor recompile scripts in the project.
public static void RequestScriptCompilation()
Remarks
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 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 might 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.
RequestScriptCompilation(RequestScriptCompilationOptions)
Allows you to request that the Editor recompile scripts in the project.
public static void RequestScriptCompilation(RequestScriptCompilationOptions options)
Parameters
Optional parameter to specify whether the Editor should clear the build cache before compilation.
Remarks
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 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 might 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.