Overview
1. 找到預設的 Templates
2. 更改或建立你自己的 Template
3. 重新啟動 Unity
Unity 預設產生的 C# Behaviour Script
總是會帶有附註姐的 Start 和 Update 函式
不想每次都要重複做修改和刪除的動作
我們可以自訂想要的 Templates
1. 找到預設的 Templates
Mac:
/Applications/Unity/Unity.app/Contents/Resources/ScriptTemplates/
Windows:
C:/Program Files (x86)/Unity/Editor/Data/Resources/ScriptTemplates
2. 更改或建立你自己的 Template
目前使用 JavaScript 來開發的應該是少數
所以我是直接把 JavaScript 的 Template 直接改成自己的
另外號碼越低的會排越上面
所以想要排最上面的話,要把原本的 81 號 C# Script 改成 82
自己的 C# Script 使用 81
比方說加上自己的 MIT License
// // Copyright (C) 2017 Scissor Lee // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using UnityEngine; public class #SCRIPTNAME# { }
3. 重新啟動 Unity
可以看到剛剛建立的 Template 出現了!
[…] 腳本模板(一)、修改Unity預設模板 腳本模板(二)、Script Create Dialog 腳本模板(三)、Singleton ScriptableObject + Asset 腳本模板(四)、File Enum Creator […]