1 using UnityEngine; 2 using System.Collections; 3 4 public class MainPlayer : MonoBehaviour { 5 6 // Use this for initialization 7 void Start () { 8 9 } 10 11 // Update is called once per frame 12 void Update () { 13 14 } 15 }
剛開始很方便,但不必超過5次,你就會覺得很煩,因為你每次都要砍掉註解,或是根本不需要 Start()/Update()。有這種困擾的話,可以去改一下 template:
$(UNITY_FOLDER)\Editor\Data\Resources\ScriptTemplates\81-C# Script-NewBehaviourScript.cs.txt
我自己有在用 doxygen, 加上懶得一一補上 import,所以常用的 libs 都先寫了,看起來像這樣:
1 namespace ThisGame 2 { 3 using UnityEngine; 4 using UnityEngine.UI; 5 using System.Collections; 6 using System.Collections.Generic; 7 using System; 8 using Random = UnityEngine.Random; 9 10 using UnityEngine.Events; 11 using UnityEngine.EventSystems; 12 13 /** 14 * @brief #SCRIPTNAME# 15 * 16 * 17 */ 18 public class #SCRIPTNAME# : MonoBehaviour 19 { 20 21 } 22 }
沒有留言:
張貼留言