Manasvee Kumar
Manasvee Kumar

Reputation: 51

Create script with custom template

I need to make the following as the default template of my new C# scripts added in Unity Editor.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace ProjectName
{
    public class ScriptName: MonoBehaviour
    {

    /// <summary>
    /// 
    /// </summary>

    #region Fields
    #endregion

    #region MonoBehaviour Messages

    void Start()
    {

    }

    void Update()
    {

    }

    #endregion

    #region Methods
    #endregion

    }
}

The ProjectName is a constant for all scripts, while ScriptName is defined on script asset creation.

I tried using UnityEditor documentation and checked this question "Unity Add Default Namespace to Script Template?" but couldn't implement the above template

Upvotes: 4

Views: 332

Answers (1)

saki
saki

Reputation: 174

I checked that but there's no problem.

Check This Point

  1. Is AddNameSpace class in the Assets/Editor in project?

  2. If you develop CS, modify 81-C# Script-NewBehaviourScript.cs in Unity\Editor\Data\Resources\ScriptTemplates

Upvotes: 3

Related Questions