fix(ShaderBake): 修正分组折叠取错节点,以及命令缓冲二次释放

- BindSections 传的是分组壳的名字,Q<Toggle> 取不到头部的 -head 节点,所有分组都报"不成对"
- CommandBuffer 先 Release 再 Dispose 属于二次释放,2021.3 关闭窗口时抛 _unity_self 为空
This commit is contained in:
2026-11-05 17:59:04 +08:00
parent f8f4a3cfd0
commit ac4bcb341f
2 changed files with 17 additions and 8 deletions
+7 -6
View File
@@ -289,12 +289,13 @@ namespace XericUI.ShaderBake.Editor
private void BindSections() private void BindSections()
{ {
Collapsible("sec-source", "sec-source-body"); // 头部是 Toggle(名字带 -head),外层同名容器只是分组壳,别拿它去 Q<Toggle>
Collapsible("sec-output", "sec-output-body"); Collapsible("sec-source-head", "sec-source-body");
Collapsible("sec-surface", "sec-surface-body"); Collapsible("sec-output-head", "sec-output-body");
Collapsible("sec-camera", "sec-camera-body"); Collapsible("sec-surface-head", "sec-surface-body");
Collapsible("sec-globals", "sec-globals-body"); Collapsible("sec-camera-head", "sec-camera-body");
Collapsible("sec-props", "sec-props-body"); Collapsible("sec-globals-head", "sec-globals-body");
Collapsible("sec-props-head", "sec-props-body");
} }
private void Collapsible(string headName, string bodyName) private void Collapsible(string headName, string bodyName)
+9 -1
View File
@@ -408,8 +408,16 @@ namespace XericUI.ShaderBake
{ {
if (m_Buffer != null) if (m_Buffer != null)
{ {
m_Buffer.Release(); // 只 Dispose:Dispose 内部已经 Release,再单独 Release 一次会二次释放,
// 2021.3 上表现为关闭窗口时抛 _unity_self 为空的 ArgumentNullException
try
{
m_Buffer.Dispose(); m_Buffer.Dispose();
}
catch (Exception)
{
// 退出编辑器/域重载期间原生对象可能已被回收,这时再报错没有意义
}
m_Buffer = null; m_Buffer = null;
} }
ReleaseTempObject(m_MultiSampleSource, immediate); ReleaseTempObject(m_MultiSampleSource, immediate);