Unity Namespace Automation

Опубликовано: 07 Февраль 2025
на канале: Nichathan Gaming
33
0

Short Guide:
Go to C:\Program Files\Unity\Hub\Editor\2022.3.22f1\Editor\Data\Resources\ScriptTemplates
*Replace "2022.3.22f1" with your editor version

Give permission to edit 81-C# Script-NewBehaviourScript.cs.txt *if needed

Add whatever you want your default scripts to look like when you create them.

What is a namespace?
A namespace groups all of the files with the namespace together and keeps them from overriding other files of the same name outside of the namespace.
UnityEngine is a namespace and System is a namespace and that's how they both have a static Random class.

Why use a namespace?
Well namepaces let script editors and others see which company or entity created the script. It's like signing your name on a painting.
More importantly however, if you want to publish to the Unity Asset Store, all of the scripts will have to have a namespace so they don't interfere with the users files.