-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add tool and temp folder * add a tool, get name of all scripts * generate names in alphanumeric order * add assembly, rename folder devtools in editortools, add namespace
- Loading branch information
Showing
7 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"name": "EditorTools" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
|
||
using UnityEngine; | ||
using UnityEditor; | ||
using System.IO; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace EditorTools | ||
{ | ||
class GetNameOfAllScript : EditorWindow | ||
{ | ||
private const string filePath = "Assets/Temp/ScriptsNames.txt"; | ||
private const string scriptsPath = "Assets/Scripts/SS3D"; | ||
private static List<string> scriptNames; | ||
|
||
[MenuItem("Tools/SS3D/Get name of all scripts")] | ||
public static void ShowWindow() | ||
{ | ||
GetWindow<GetNameOfAllScript>("Get name of all scripts"); | ||
} | ||
private void OnGUI() | ||
{ | ||
GUILayout.Label("Generate name of all SS3D scripts,\n write them in file located at " + filePath + "."); | ||
if (GUILayout.Button("Generate names")) | ||
{ | ||
scriptNames = new List<string>(); | ||
DirectoryInfo rootDir = new DirectoryInfo(scriptsPath); | ||
File.Delete(filePath); | ||
WalkDirectoryTree(rootDir); | ||
scriptNames.Sort((x, y) => string.Compare(x, y)); | ||
foreach (string name in scriptNames) | ||
{ | ||
File.AppendAllText(filePath, name); | ||
} | ||
scriptNames.Clear(); | ||
} | ||
} | ||
|
||
static void WalkDirectoryTree(DirectoryInfo root) | ||
{ | ||
FileInfo[] files = null; | ||
DirectoryInfo[] subDirs = null; | ||
|
||
// First, process all the files directly under this folder | ||
files = root.GetFiles("*.cs"); | ||
|
||
if (files != null) | ||
{ | ||
foreach (FileInfo fi in files) | ||
{ | ||
scriptNames.Add(fi.Name + "\n"); | ||
} | ||
|
||
// Now find all the subdirectories under this directory. | ||
subDirs = root.GetDirectories(); | ||
|
||
foreach (DirectoryInfo dirInfo in subDirs) | ||
{ | ||
// Resursive call for each subdirectory. | ||
WalkDirectoryTree(dirInfo); | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.