Hello! I want to know how to add stuff to a script when it is created, like the way that scripts always include void
Update () {} void Start () {}
I want to add
if (GameObject.Find("Camera").GetComponent().Paused == false) { The Rest of void Update }
inside void Update to every script I create (so that the stuff only happens if the game’s not paused) and I think i’d find myself adding that more often than i’d find myself deleting it if it were there by default.
Also,it’d be cool if there were a way so that it’s a whole new type of script (so when right-clicking the project window and going to add>script I can select c# script, JavaScript script, Boo script, and Predefined Pause Script (C#) )
i think it may be the script template with unity3D. if you os is windows ,you can open the direction C:\Program Files (x86)\Unity\Editor\Data\Resources\ScriptTemplates . (if os is mac ,the path is /Applications/Unity/Unity.app/Contents/Resources/ScriptTemplates/81-C#\ Script-NewBehaviourScript.cs.txt ) there are four files ,include c# , boo, javascript template file. below is c# file :
using UnityEngine;
using System.Collections;
public class #SCRIPTNAME# : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
so if you want to add some code to the script when you create , you can add the code in the file.
maybe it will help you.