Fix InlineEditor recreated every frame for null values

This commit is contained in:
VladV 2022-05-19 16:58:38 +03:00
parent 821812b5f0
commit 5845f1758a

View File

@ -86,12 +86,14 @@ namespace TriInspector.Elements
}
else
{
if (_editor == null && _property.IsExpanded && !_property.IsValueMixed)
var shouldDrawEditor = _property.IsExpanded && !_property.IsValueMixed;
if (_editor == null && shouldDrawEditor && _property.Value is Object obj && obj != null)
{
_editor = Editor.CreateEditor((Object) _property.Value);
_editor = Editor.CreateEditor(obj);
}
if (_editor != null && _property.IsExpanded && !_property.IsValueMixed)
if (_editor != null && shouldDrawEditor)
{
Rect indentedEditorPosition;
using (TriGuiHelper.PushIndentLevel())