浏览代码

Fixed a null ref exception with DebugWindow when users keep the window open then close/reopen Unity

/Branch_DebugWindowFix
Julien Ignace 7 年前
当前提交
d71724e7
共有 1 个文件被更改,包括 15 次插入1 次删除
  1. 16
      ScriptableRenderPipeline/Core/CoreRP/Editor/Debugging/DebugWindow.cs

16
ScriptableRenderPipeline/Core/CoreRP/Editor/Debugging/DebugWindow.cs


if (m_Settings == null)
m_Settings = CreateInstance<DebugWindowSettings>();
if (m_WidgetStates == null)
// States are ScriptableObjects (necessary for Undo/Redo) but are not saved on disk so when the editor is closed then reopened, any existing debug window will have its states set to null
// Since we don't care about persistance in this case, we just re-init everything.
if (m_WidgetStates == null || !AreWidgetStatesValid())
m_WidgetStates = new WidgetStateDictionary();
if (s_WidgetStateMap == null || s_WidgetDrawerMap == null || s_TypeMapDirty)

m_WidgetStates.Clear();
}
}
bool AreWidgetStatesValid()
{
foreach (var state in m_WidgetStates)
{
if(state.Value == null)
{
return false;
}
}
return true;
}
void MarkDirty()

正在加载...
取消
保存