【m】修改打包配置
This commit is contained in:
@@ -21,6 +21,7 @@ public static class ShaderVariantCollector
|
|||||||
}
|
}
|
||||||
|
|
||||||
private const float WaitMilliseconds = 3000f;
|
private const float WaitMilliseconds = 3000f;
|
||||||
|
|
||||||
private const float SleepMilliseconds = 3000f;
|
private const float SleepMilliseconds = 3000f;
|
||||||
// private static string _savePath;
|
// private static string _savePath;
|
||||||
// private static string _packageName;
|
// private static string _packageName;
|
||||||
@@ -35,6 +36,14 @@ public static class ShaderVariantCollector
|
|||||||
// 新增任务队列
|
// 新增任务队列
|
||||||
private static Queue<CollectTask> _taskQueue = new Queue<CollectTask>();
|
private static Queue<CollectTask> _taskQueue = new Queue<CollectTask>();
|
||||||
private static CollectTask _currentTask;
|
private static CollectTask _currentTask;
|
||||||
|
public static string OriginalScenePath { get; set; }
|
||||||
|
|
||||||
|
static ShaderVariantCollector()
|
||||||
|
{
|
||||||
|
// 保存当前场景路径
|
||||||
|
OriginalScenePath = EditorSceneManager.GetActiveScene().path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 新增初始化方法
|
// 新增初始化方法
|
||||||
private static void InitializeTask(CollectTask task)
|
private static void InitializeTask(CollectTask task)
|
||||||
@@ -48,6 +57,7 @@ public static class ShaderVariantCollector
|
|||||||
|
|
||||||
task.Steps = ESteps.Prepare;
|
task.Steps = ESteps.Prepare;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开始收集
|
/// 开始收集
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -74,8 +84,13 @@ public static class ShaderVariantCollector
|
|||||||
{
|
{
|
||||||
EditorApplication.update -= EditorUpdate;
|
EditorApplication.update -= EditorUpdate;
|
||||||
EditorApplication.update += EditorUpdate;
|
EditorApplication.update += EditorUpdate;
|
||||||
}
|
|
||||||
|
|
||||||
|
// 聚焦到游戏窗口
|
||||||
|
//EditorTools.FocusUnityGameWindow();
|
||||||
|
|
||||||
|
// 创建临时测试场景
|
||||||
|
CreateTempScene();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void EditorUpdate()
|
private static void EditorUpdate()
|
||||||
@@ -86,6 +101,7 @@ public static class ShaderVariantCollector
|
|||||||
_currentTask = _taskQueue.Dequeue();
|
_currentTask = _taskQueue.Dequeue();
|
||||||
InitializeTask(_currentTask);
|
InitializeTask(_currentTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_currentTask == null)
|
if (_currentTask == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -114,7 +130,7 @@ public static class ShaderVariantCollector
|
|||||||
_currentTask.AllMaterials.RemoveRange(0, count);
|
_currentTask.AllMaterials.RemoveRange(0, count);
|
||||||
CollectVariants(range);
|
CollectVariants(range);
|
||||||
|
|
||||||
if ( _currentTask.AllMaterials.Count > 0)
|
if (_currentTask.AllMaterials.Count > 0)
|
||||||
{
|
{
|
||||||
_currentTask.ElapsedTime = Stopwatch.StartNew();
|
_currentTask.ElapsedTime = Stopwatch.StartNew();
|
||||||
_currentTask.Steps = ESteps.CollectSleeping;
|
_currentTask.Steps = ESteps.CollectSleeping;
|
||||||
@@ -136,10 +152,10 @@ public static class ShaderVariantCollector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( _currentTask.Steps == ESteps.WaitingDone)
|
if (_currentTask.Steps == ESteps.WaitingDone)
|
||||||
{
|
{
|
||||||
// 注意:一定要延迟保存才会起效
|
// 注意:一定要延迟保存才会起效
|
||||||
if ( _currentTask.ElapsedTime.ElapsedMilliseconds > WaitMilliseconds)
|
if (_currentTask.ElapsedTime.ElapsedMilliseconds > WaitMilliseconds)
|
||||||
{
|
{
|
||||||
_currentTask.ElapsedTime.Stop();
|
_currentTask.ElapsedTime.Stop();
|
||||||
_currentTask.Steps = ESteps.None;
|
_currentTask.Steps = ESteps.None;
|
||||||
@@ -155,8 +171,18 @@ public static class ShaderVariantCollector
|
|||||||
|
|
||||||
// 如果队列还有任务,立即触发下一次更新
|
// 如果队列还有任务,立即触发下一次更新
|
||||||
if (_taskQueue.Count > 0)
|
if (_taskQueue.Count > 0)
|
||||||
|
{
|
||||||
EditorApplication.QueuePlayerLoopUpdate();
|
EditorApplication.QueuePlayerLoopUpdate();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// 恢复原场景
|
||||||
|
if (!string.IsNullOrEmpty(OriginalScenePath))
|
||||||
|
{
|
||||||
|
EditorSceneManager.OpenScene(OriginalScenePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +194,8 @@ public static class ShaderVariantCollector
|
|||||||
private static List<string> GetAllMaterials()
|
private static List<string> GetAllMaterials()
|
||||||
{
|
{
|
||||||
// 获取所有打包的资源
|
// 获取所有打包的资源
|
||||||
CollectResult collectResult = AssetBundleCollectorSettingData.Setting.BeginCollect(_currentTask.PackageName, false, false);
|
CollectResult collectResult =
|
||||||
|
AssetBundleCollectorSettingData.Setting.BeginCollect(_currentTask.PackageName, false, false);
|
||||||
|
|
||||||
// 搜集所有材质球
|
// 搜集所有材质球
|
||||||
int progressValue = 0;
|
int progressValue = 0;
|
||||||
@@ -289,7 +316,6 @@ public static class ShaderVariantCollector
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 新增任务类
|
// 新增任务类
|
||||||
private class CollectTask
|
private class CollectTask
|
||||||
{
|
{
|
||||||
@@ -303,4 +329,3 @@ public static class ShaderVariantCollector
|
|||||||
public List<GameObject> AllSpheres = new List<GameObject>();
|
public List<GameObject> AllSpheres = new List<GameObject>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.main",
|
"name": "com.staryevo.main",
|
||||||
"version": "1.3.20",
|
"version": "1.3.21",
|
||||||
"displayName": "00.StaryEvo",
|
"displayName": "00.StaryEvo",
|
||||||
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user