- Home /
Question by
racsoknight · Feb 08, 2018 at 04:55 PM ·
unity 5unityeditor
Relate open folder with a text field?
Hi, i want to select a folder from my computer, and when i select the folder i want to see and hold the path in a text field?
i have a code like this,maybe this help to understand my problem XD
[MenuItem("lol1/lol2", false, 51)]
static void Initialize()
{
GetWindow(typeof(lol), true, "lolPreferences");
}
private void OnGUI()
{
GUILayout.Label("lolModels", EditorStyles.boldLabel);
EditorGUILayout.TextField("Path", ???);
if (GUILayout.Button("Browse"))
{
string path = EditorUtility.OpenFolderPanel("Load lol Files", "", "");
string[] files = Directory.GetFiles(path);
foreach (string file in files)
if (file.EndsWith(".lol"))
File.Copy(file, EditorApplication.currentScene);
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612152224im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is it possible to create a hole for a door in a wall-like cube? 2 Answers
Draw a line from object to indicate power 0 Answers
Unity Editor not installing from unity hub.,Unity Editor is not installing from unity hub. 0 Answers
How to create a trigger stopping audio in Unity 1 Answer
Change from Editor utility to Game Object ,Change Editor Utility in to Game Object 0 Answers