public override void ShowMenu(SerializedProperty property) { string directory = property.stringValue; string sel = ""; directory = KingUtil.AbsolutePath(directory); if (string.IsNullOrEmpty(directory)) { directory = FileSelectAttribute.directory; } if (FileSelectAttribute.dialog == FileSelectAttribute.DialogType.Load) { sel = EditorUtility.OpenFilePanel(FileSelectAttribute.title, directory, FileSelectAttribute.extensions); } else { sel = EditorUtility.SaveFilePanel(FileSelectAttribute.title, directory, FileSelectAttribute.defaultName, FileSelectAttribute.extensions); } if (!string.IsNullOrEmpty(sel)) { selectVal = FileSelectAttribute.absolute ? KingUtil.AbsolutePath(sel): KingUtil.RelativePath(sel); selectPath = property.propertyPath; } }
public override void ShowMenu(SerializedProperty property) { string folder = property.stringValue; string sel = ""; folder = string.IsNullOrEmpty(folder) ? "" : Path.GetDirectoryName(Path.GetFullPath(folder) + Path.DirectorySeparatorChar); if (string.IsNullOrEmpty(folder)) { folder = FolderSelectAttribute.folder; } if (FolderSelectAttribute.dialog == FolderSelectAttribute.DialogType.Load) { sel = EditorUtility.OpenFolderPanel(FolderSelectAttribute.title, folder, FolderSelectAttribute.defaultName); } else { sel = EditorUtility.SaveFolderPanel(FolderSelectAttribute.title, folder, FolderSelectAttribute.defaultName); } if (!string.IsNullOrEmpty(sel)) { selectVal = FolderSelectAttribute.absolute ? KingUtil.AbsolutePath(sel) : KingUtil.RelativePath(sel); selectPath = property.propertyPath; } }