Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to make a Folder Field?

Discussion in 'UI Toolkit' started by MadWatch, Apr 1, 2022.

  1. MadWatch

    MadWatch

    Joined:
    May 26, 2016
    Posts:
    112
    I'm creating an editor extension. I'm looking for a way to display a field allowing the user to select a folder in the project. Something like this:
    Screenshot_20220401_104358.png

    I couldn't find a good way to do this. The closest I got is using an ObjectField and setting the objectType property to typeof(DefaultAsset). This is not ideal because DefaultAsset can be almost anything, not just a folder.

    I tried creating my own FolderField type by coping the code of ObjectField, but it didn't work because that code calls a lot of internal method I don't have access to.

    Is these another way to do this?
    Thanks
     
    Nexer8 likes this.