When I use EditorUtiliy.OpenFolderPanel method for getting directory path on operating system(macOSX in Unity 2017.3, the editor is crashed always. When I use the same method in Unity 2017.2 or older versions of Unity, the editor is not crashed.
How can I solve this problem? Please help me.
Thanks for your time.
private void SetRootDirectory()
{
string path = Application.dataPath + "/Resources/root.txt";
string rootPath = EditorUtility.OpenFolderPanel("Select Location", Application.dataPath, ""); //editor is crashing because of this line
using (FileStream fs = new FileStream(path, FileMode.Create))
{
using (StreamWriter writer = new StreamWriter(fs))
{
writer.Write(rootPath);
}
}
AssetDatabase.Refresh();
}
↧