4

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

1
  • but couldn't implement the above template - why not? Any errors/ unexpected behaviour? Commented Apr 2, 2019 at 10:11

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.