脚本模板的路径:
Window:
Unity安装目录\Editor\Data\Resources\ScriptTemplates\81-C# Script-
NewBehaviourScript.cs.txt
Mac:
Unity.app/Contents/Resources/ScriptTemplates/81-C# Script-NewBehaviourScript.cs.txt
C#模板
/*************************************************************************
* Copyright © 2018-2020 #AUTHORNAME#. All rights reserved.
*------------------------------------------------------------------------
* File : #SCRIPTNAME#.cs
* Author : #AUTHORNAME#
* Date : #CREATETIME#
* Description :
*************************************************************************/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace JIANING(修改为你的命名空间) {
public class #SCRIPTNAME# : MonoBehaviour {
// Use this for initialization
void Start () {
#NOTRIM#
}
// Update is called once per frame
void Update () {
#NOTRIM#
}
}
}
并在项目的Editor
文件夹下创建以下脚本
CodeEditor.cs
using System.IO;
namespace JIANING.Editor.Code {
public class CodeEditor : UnityEditor.AssetModificationProcessor {
public const string authorName = "JIANING(修改为你自己的名称即可)";
public static void OnWillCreateAsset(string path) {
path = path.Replace(".meta", "");
if (path.ToLower().EndsWith(".cs")) {
string content = File.ReadAllText(path);
content = content.Replace("#AUTHORNAME#", authorName);
content = content.Replace("#CREATETIME#", System.DateTime.Now.ToShortDateString());
File.WriteAllText(path, content);
}
}
}
}
注意:
在创建新脚本之前,需要先将脚本CodeEditor.cs
拖入到工程目录下的Editor
(如果没有就自己创建一个命名为Editor
的文件夹)目录中去
Just beneath, are quite a few entirely not associated internet sites to ours, nonetheless, they may be certainly worth going over. Danice Pate Urana
Sweet website, super design and style, rattling clean and utilize genial. Carleen Carmine Kahler
You saved me so much time glad I found your webpage. Roxie Standford Ricky
My family members always say that I am killing my time here at web, except I know I am getting know-how daily by reading thes pleasant articles. Blisse Osbourn Christa
I feel this is among the most important info for me. Poppy Forester Greenquist
Way cool! Some extremely valid points! I appreciate you penning this article and also the rest of the site is extremely good. Myra Lowrance Aretta
naturally like your web site however you need to test the spelling on several of your posts. A number of them are rife with spelling issues and I find it very bothersome to inform the truth however I will definitely come again again. Pearline Darrell Gay
Foil in contact with cooking food leeches aluminium, deposited into breast tissue etc on consumption Kial Frasier Salvadore
Simply wanna remark on few general things, The website design and style is perfect, the written content is really great : D. Tilly Bartie Brothers Olimpia Morse Wiencke
Thanks for the sensible critique. Me and my neighbor were just preparing to do some research about this. We got a grab a book from our local library but I think I learned more clear from this post. I am very glad to see such great information being shared freely out there. Ninnette Zacharie Southard
Can I simply say that of a relief to seek out a person that in fact knows what theyre talking about on the web. You actually know how to bring an issue to light to make it important. Lots more people must check out this and see why side of the story. I cant think youre less popular simply because you certainly develop the gift. Reba Jozef Giff
As I web site possessor I believe the content matter here is rattling fantastic , appreciate it for your efforts. You should keep it up forever! Good Luck. Katine Roger Wakeen