public override void OnInspectorGUI() { GameObjectLoader prefabLoader = (GameObjectLoader)target; EditorGUI.BeginChangeCheck(); _prefabAsset = EditorGUILayout.ObjectField("Source Prefab", _prefabAsset, typeof(GameObject), false) as GameObject; if (EditorGUI.EndChangeCheck()) { if (_prefabAsset != null) { _filePath.stringValue = AssetDatabase.GetAssetPath(_prefabAsset); _fileGUID.stringValue = AssetDatabase.AssetPathToGUID(_filePath.stringValue); } else { _filePath.stringValue = null; _fileGUID.stringValue = null; } serializedObject.ApplyModifiedProperties(); } EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(EditorGUIUtility.labelWidth - (EditorGUI.indentLevel * 15.0f) - 4.0f)); if (GUILayout.Button("Load")) { prefabLoader.Load(); } if (GUILayout.Button("Unload")) { prefabLoader.Unload(); } GUILayout.FlexibleSpace(); } EditorGUILayout.EndHorizontal(); }