Skip to content

Instantly share code, notes, and snippets.

@baba-s
Created March 9, 2014 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baba-s/9446762 to your computer and use it in GitHub Desktop.
Save baba-s/9446762 to your computer and use it in GitHub Desktop.
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