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

26 lines
948 B
C#
Raw Normal View History

2025-08-20 11:14:21 +08:00
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;
}
}
}