Skip to content

File Path

[FilePath] attribute allow to select corrent path to file via build-in in OS panel.


Support Types

  • String

Parameters

Parameter Name Description
Title File panel title.
Directory Start panel directory.
Extension File extension filter.
RelativePath Convert path to project relative.
Only if selected file inside Assets folder.

Examples

[FilePath]
public string filePath;

[FilePath(Title = "Select Material...")]
public string materialPath;

[FilePath(Title = "Select Texture...", "Assets/Textures", RelativePath = true)]
public string texturePath;

[FilePath(RelativePath = true)]
public string scenePath;
Note
  1. Make sure that you have added ApexInspector namespace in your script, to get access to all attributes.
    using ApexInspector;
    

Demo

using ApexInspector;
using UnityEngine;

public class ExampleComponent : MonoBehaviour
{
    [FilePath(RelativePath = true)]
    public string scriptPath;
}

Live-demo

Live demo