FolderDialog

Options

  • Directory Tree View DirectoryTreeView

    DirectoryTreeView widget.

  • Ok Button Button

    Button to close dialog.

namespace UIWidgets.Examples
{
   using UIWidgets;
   using UnityEngine;
   using UnityEngine.UI;

     /// <summary>
     /// Test FolderDialog.
     /// </summary>
     public class TestFolderDialog : MonoBehaviour
     {
             [SerializeField]
             FolderDialog PickerTemplate;

             [SerializeField]
             Text Result;

             string currentValue = string.Empty;

             /// <summary>
             /// Show picker and log selected value.
             /// </summary>
             public void Test()
             {
                     // create picker by template
                     var picker = PickerTemplate.Clone();

                     // show picker
                     picker.Show(currentValue, ValueSelected, Canceled);
             }

             void ValueSelected(string value)
             {
                     currentValue = value;
                     Debug.Log("value: " + value);
             }

             void Canceled()
             {
                     Debug.Log("canceled");
             }

             /// <summary>
             /// Show picker and display selected value.
             /// </summary>
             public void TestShow()
             {
                     // create picker by template
                     var picker = PickerTemplate.Clone();

                     // show picker
                     picker.Show(currentValue, ShowValueSelected, ShowCanceled);
             }

             void ShowValueSelected(string value)
             {
                     currentValue = value;
                     Result.text = "Value: " + value;
             }

             void ShowCanceled()
             {
                     Result.text = "Canceled";
             }
     }
}