“ 呃伯复。。邢笙。最近永強(qiáng)整天在村頭徘徊啸如,看似漫無(wú)目的,其實(shí)他口袋里有一板磚氮惯,肯定不是鍛煉身體组底。他希望能狹路相逢鐵腕山。出其不意給老鐵后腦勺一磚頭筐骇。可惜啊江滨,一個(gè)來(lái)月就這么過(guò)去了铛纬。鐵腕山也沒(méi)出現(xiàn)。”
今天講如何在創(chuàng)建腳本的時(shí)候給腳本增加一個(gè)備注開(kāi)頭
image
在Editor文件下創(chuàng)建一個(gè)腳本《ScriptTopComment》
using System.IO;
using System.Collections.Generic;
using UnityEngine;
namespace UGUIFrameWorkEditor
{
public class ScriptTopComment : UnityEditor.AssetModificationProcessor
{
public static void OnWillCreateAsset(string path)
{
path = path.Replace(".meta", "");
if (!path.EndsWith(".cs")) return;
string scriptName = path.Substring(path.LastIndexOf('/')+1 );
string allText = "/********************************************************************\r\n"
+ " Copyright (C) 2017 IGG RD1 COG\r\n"
+ " 類 名:#FILE_BASE#\r\n"
+ " 創(chuàng)建時(shí)間:#CreateTime#\r\n"
+ " 作 者:Birth.Fat \r\n"
+ " 描 述:\r\n"
+ " 版 本:1.0\r\n"
+ "*********************************************************************/\r\n";
allText += File.ReadAllText(path);
allText = allText.Replace("#CreateTime#", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
allText = allText.Replace("#FILE_BASE#", scriptName);
File.WriteAllText(path, allText);
}
}
}
好了 現(xiàn)在創(chuàng)建一個(gè)新Class試試吧唬滑,我現(xiàn)在創(chuàng)建一個(gè)新Class告唆。
創(chuàng)建好后打開(kāi)看一下,有沒(méi)有驚喜晶密!
/********************************************************************
Copyright (C) 2017 IGG RD1 COG
類 名:NewBehaviourScript.cs
創(chuàng)建時(shí)間:2019-08-01 17:12:56
作 者:Birth.Fat
描 述:
版 本:1.0
*********************************************************************/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
最近在研究Midi文件的解析擒悬,因?yàn)椴欢魳?lè),所以研究的很想吐稻艰。研究Midi的目的是想做一個(gè)有關(guān)音樂(lè)類型的游戲懂牧。所以相關(guān)的技術(shù)先研究一下,如果你也有興趣,請(qǐng)給我留言僧凤,任何想法都可以畜侦,核心玩法上,美術(shù)表現(xiàn)上躯保,策劃細(xì)節(jié)上都可以旋膳。期待你的留言。