mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-07-19 00:31:52 -05:00
add null check
This commit is contained in:
parent
59776bf2bc
commit
403e2547c3
|
|
@ -6,6 +6,7 @@ namespace VRM
|
|||
[CustomEditor(typeof(VRMMeta))]
|
||||
public class VRMMetaEditor : Editor
|
||||
{
|
||||
VRMMeta m_target;
|
||||
Editor m_Inspector;
|
||||
SerializedProperty m_VRMMetaObjectProp;
|
||||
|
||||
|
|
@ -16,14 +17,21 @@ namespace VRM
|
|||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_target = target as VRMMeta;
|
||||
m_VRMMetaObjectProp = serializedObject.FindProperty(nameof(VRMMeta.Meta));
|
||||
m_Inspector = Editor.CreateEditor(m_VRMMetaObjectProp.objectReferenceValue);
|
||||
if (m_target.Meta != null)
|
||||
{
|
||||
m_Inspector = Editor.CreateEditor(m_VRMMetaObjectProp.objectReferenceValue);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(m_VRMMetaObjectProp);
|
||||
m_Inspector.OnInspectorGUI();
|
||||
if (m_Inspector != null)
|
||||
{
|
||||
m_Inspector.OnInspectorGUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user