Created
March 9, 2014 12:02
-
-
Save baba-s/9446762 to your computer and use it in GitHub Desktop.
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
using UnityEditor; | |
public static class MyClassCreator | |
{ | |
[MenuItem("Tools/Create My Class")] | |
private static void Create() | |
{ | |
// ファイルに書き込む文字列を作成します | |
var builder = new System.Text.StringBuilder(); | |
builder.AppendLine("public class MyClass"); | |
builder.AppendLine("{"); | |
builder.AppendLine("}"); | |
// 新しいファイルを作成して文字列を書き込みます | |
System.IO.File.WriteAllText( | |
"Assets/MyClass.cs", | |
builder.ToString(), | |
System.Text.Encoding.UTF8); | |
// AssetDatabaseをリフレッシュします | |
AssetDatabase.Refresh( | |
ImportAssetOptions.ImportRecursive); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment