26 lines
948 B
C#
26 lines
948 B
C#
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;
|
||
}
|
||
}
|
||
|
||
} |