赞
踩
文件名 CompilationWindow.cs
public class CompilationWindow : EditorWindow { [MenuItem("Window/Pump Editor/Compilation")] private static void ShowWindow() { var window = GetWindow<CompilationWindow>(); window.titleContent = new GUIContent("CompilationWindow"); window.Show(); } private void OnGUI() { if (GUILayout.Button("Request Script Compilation")) { #if UNITY_2019_3_OR_NEWER CompilationPipeline.RequestScriptCompilation(); #elif UNITY_2017_1_OR_NEWER var editorAssembly = System.Reflection.Assembly.GetAssembly(typeof(Editor)); var editorCompilationInterfaceType = editorAssembly.GetType("UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterfaceType"); var dirtyAllScriptMethod = editorCompilationInterfaceType.GetMethod("DirtyAllScripts", BindingFlags.Static | BindingFlags.Public); dirtyAllScriptMethod?.Invoke(editorCompilationInterfaceType, null); #endif } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。