Search Unity

Feedback Options in the Unity Hub for default script template.

Discussion in 'Editor & General Support' started by bibbis, Apr 4, 2020.

  1. bibbis

    bibbis

    Joined:
    Dec 5, 2016
    Posts:
    33
    There is a text file located inside every editor install folder that decides what a new script will look like when it's created.
    It's called: 81-C# Script-NewBehaviourScript.cs.txt
    And it's located here: %EDITOR_PATH%\Editor\Data\Resources\ScriptTemplates
    (in my case it's "D:\Unity Editors\2019.3.2f1\Editor\Data\Resources\ScriptTemplates")

    It looks something like this:
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class #SCRIPTNAME# : MonoBehaviour {
    6.  
    7.    // Use this for initialization
    8.    void Start () {
    9.  
    10.    }
    11.  
    12.    // Update is called once per frame
    13.    void Update () {
    14.  
    15.    }
    16. }
    17.  

    I would love some options in the Unity Hub to manage this template.
    Options to:
    -Open the current template file for editing.
    -Select a default template file that future installs will use (lets your navigate to and select a text file, and the text file that you select does NOT need to have the name 81-C# Script-NewBehaviourScript.cs.txt).

    Perhaps the option for assigning a default template file could be in Preferences > General similar to how you select the editor install path.
    And the option to edit current templates is located in the context menu for each installed version under the Installs tab in the hub:
    template 1.png

    I understand that editing this file incorrectly will break things in Unity!
    So if something like this was to be implemented I recommend either having a warning that quickly explains the risk, or having a verification check of the new file, or even having a little text editor that will only allow you to edit certain things of the template.

    What do you guys think?
     
  2. bibbis

    bibbis

    Joined:
    Dec 5, 2016
    Posts:
    33
    Ah there is a sub forum for the Unity Hub.
    Could this thread be moved into that section?
     
unityunity