ScriptTemplates

Automatically synchronizes custom script templates from the project's ScriptTemplates folder into Unity's Editor installation directory, ensuring project-specific "Create > C# Script" templates are always available.

Architecture

spinner

Data Flow

spinner

Key Concepts

  • Auto-sync on load: Runs every time the editor loads via [InitializeOnLoad] static constructor

  • Content-aware: Only copies files when content has actually changed (line-by-line comparison)

  • .txt filter: Only processes .txt template files (Unity's template format)

  • Source: Application.dataPath (project Assets folder) — searched recursively for a ScriptTemplates subfolder

  • Target: EditorApplication.applicationContentsPath (Unity Editor install) — searched recursively for the ScriptTemplates subfolder

circle-info

Unity script templates use a naming convention like 81-C# Script-NewBehaviourScript.cs.txt. The number prefix controls menu order and the name between hyphens becomes the menu item text.

Classes

Class
Purpose

Auto-syncs custom script templates to the Unity Editor installation

See Also

Last updated