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 TriPropertyTree _inspector;
|
||||||
|
|
||||||
|
private TriEditorMode _editorMode;
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
var mode = TriEditorMode.None;
|
_editorMode = TriEditorMode.None;
|
||||||
|
|
||||||
var isInlineEditor = EditorStack.Count > 0;
|
var isInlineEditor = EditorStack.Count > 0;
|
||||||
if (isInlineEditor)
|
if (isInlineEditor)
|
||||||
{
|
{
|
||||||
mode |= TriEditorMode.InlineEditor;
|
_editorMode |= TriEditorMode.InlineEditor;
|
||||||
}
|
|
||||||
|
|
||||||
if (serializedObject.targetObject != null)
|
|
||||||
{
|
|
||||||
_inspector = TriPropertyTree.Create(serializedObject, mode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,8 +34,12 @@ namespace TriInspector
|
|||||||
{
|
{
|
||||||
if (_inspector == null)
|
if (_inspector == null)
|
||||||
{
|
{
|
||||||
DrawDefaultInspector();
|
if (serializedObject.targetObjects.Length == 0)
|
||||||
return;
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_inspector = TriPropertyTree.Create(serializedObject, _editorMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
serializedObject.UpdateIfRequiredOrScript();
|
serializedObject.UpdateIfRequiredOrScript();
|
||||||
|
Loading…
Reference in New Issue
Block a user