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; } /// /// 自定义文件路径选择特性 /// /// 根路径(支持特殊路径:Application.dataPath, Application.streamingAssetsPath等) /// 文件扩展名筛选(如".txt,.png") public FilePathAttribute(string rootPath, string fileExtensions = "") { RootPath = rootPath; FileExtensions = fileExtensions; } } }