Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unity Editor拡張 ReadMeを選択フォルダにつくる拡張
/*
* ReadMeファイルを作るやつ
* 2018 Akihiro Imada
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
public class ReadMeFileCreater : MonoBehaviour {
/// <summary>
/// 選択フォルダにReadMe.txtを作る
/// </summary>
[MenuItem("Assets/Create/ReadMe", false, 11)]
static void CreateReadMe()
{
if(Selection.activeObject == null)
{
Debug.Log("Faild to Create ReadMe. Select Target Dir.");
return;
}
// Asset/...
var partialPath = AssetDatabase.GetAssetPath(Selection.activeObject);
var fullPath = Path.GetFullPath(partialPath);
var readMePath = Path.Combine(fullPath, "ReadMe.txt");
var sw = new StreamWriter(readMePath, true, System.Text.Encoding.UTF8);
sw.Close();
AssetDatabase.Refresh();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.