mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 08:18:49 -05:00
Fix no targets exception in TriEditor
This commit is contained in:
parent
fc4da39d75
commit
89aff42a3c
@ -11,19 +11,16 @@ namespace TriInspector
|
||||
|
||||
private TriPropertyTree _inspector;
|
||||
|
||||
private TriEditorMode _editorMode;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
var mode = TriEditorMode.None;
|
||||
_editorMode = TriEditorMode.None;
|
||||
|
||||
var isInlineEditor = EditorStack.Count > 0;
|
||||
if (isInlineEditor)
|
||||
{
|
||||
mode |= TriEditorMode.InlineEditor;
|
||||
}
|
||||
|
||||
if (serializedObject.targetObject != null)
|
||||
{
|
||||
_inspector = TriPropertyTree.Create(serializedObject, mode);
|
||||
_editorMode |= TriEditorMode.InlineEditor;
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,10 +34,14 @@ namespace TriInspector
|
||||
{
|
||||
if (_inspector == null)
|
||||
{
|
||||
DrawDefaultInspector();
|
||||
if (serializedObject.targetObjects.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_inspector = TriPropertyTree.Create(serializedObject, _editorMode);
|
||||
}
|
||||
|
||||
serializedObject.UpdateIfRequiredOrScript();
|
||||
|
||||
Profiler.BeginSample("TriInspector.Update()");
|
||||
|
Loading…
Reference in New Issue
Block a user