FM/Assets/Scripts/FUJIFILM/ScripttableObject/PropertyAttribute/FilePathAttribute.cs

26 lines
948 B
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using UnityEngine;
namespace HK.PropertyAttribute
{
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public class FilePathAttribute : UnityEngine.PropertyAttribute
{
// 要搜索的根路径
public string RootPath { get; private set; }
// 要筛选的文件扩展名(如".txt,.png",为空则显示所有文件)
public string FileExtensions { get; private set; }
/// <summary>
/// 自定义文件路径选择特性
/// </summary>
/// <param name="rootPath">根路径支持特殊路径Application.dataPath, Application.streamingAssetsPath等</param>
/// <param name="fileExtensions">文件扩展名筛选(如".txt,.png"</param>
public FilePathAttribute(string rootPath, string fileExtensions = "")
{
RootPath = rootPath;
FileExtensions = fileExtensions;
}
}
}