mirror of https://github.com/tuyoogame/YooAsset
feat:SVC搜集工作支持在CI上进行
parent
7f41ba9a3c
commit
17fab5ad61
|
@ -214,6 +214,11 @@ namespace YooAsset.Editor
|
|||
{
|
||||
EditorWindow.FocusWindowIfItsOpen<SceneView>();
|
||||
}
|
||||
public static void CloseUnityGameWindow()
|
||||
{
|
||||
System.Type T = Assembly.Load("UnityEditor").GetType("UnityEditor.GameView");
|
||||
EditorWindow.GetWindow(T, false, "GameView", true).Close();
|
||||
}
|
||||
public static void FocusUnityGameWindow()
|
||||
{
|
||||
System.Type T = Assembly.Load("UnityEditor").GetType("UnityEditor.GameView");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
@ -6,21 +6,18 @@ using System.IO;
|
|||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public static class ShaderVariantCollector
|
||||
{
|
||||
private const float WaitMilliseconds = 1000f;
|
||||
private static string _saveFilePath;
|
||||
private static bool _isStarted = false;
|
||||
private static readonly Stopwatch _elapsedTime = new Stopwatch();
|
||||
public static Action OnCompletedCallback;
|
||||
|
||||
static ShaderVariantCollector()
|
||||
{
|
||||
EditorApplication.update += EditorUpdate;
|
||||
}
|
||||
private static void EditorUpdate()
|
||||
{
|
||||
// 注意:一定要延迟保存才会起效
|
||||
|
@ -28,14 +25,21 @@ namespace YooAsset.Editor
|
|||
{
|
||||
_isStarted = false;
|
||||
_elapsedTime.Stop();
|
||||
|
||||
|
||||
EditorApplication.update -= EditorUpdate;
|
||||
|
||||
// 保存结果
|
||||
SaveCurrentShaderVariantCollection();
|
||||
|
||||
// 创建说明文件
|
||||
CreateReadme();
|
||||
|
||||
Debug.Log($"搜集SVC完毕");
|
||||
|
||||
OnCompletedCallback?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateReadme()
|
||||
{
|
||||
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
|
||||
|
@ -59,6 +63,8 @@ namespace YooAsset.Editor
|
|||
{
|
||||
if (_isStarted)
|
||||
return;
|
||||
|
||||
EditorApplication.update += EditorUpdate;
|
||||
|
||||
if (Path.HasExtension(saveFilePath) == false)
|
||||
saveFilePath = $"{saveFilePath}.shadervariants";
|
||||
|
@ -83,8 +89,6 @@ namespace YooAsset.Editor
|
|||
_isStarted = true;
|
||||
_elapsedTime.Reset();
|
||||
_elapsedTime.Start();
|
||||
|
||||
UnityEngine.Debug.LogWarning("已经启动着色器变种收集工作,该工具只支持在编辑器下人工操作!");
|
||||
}
|
||||
|
||||
private static void CreateTemperScene()
|
||||
|
|
Loading…
Reference in New Issue