The source templates under Assets/Portfolio/Scripts/Templates are the authoritative references:
The files named Template.cs.txt and EditorTemplate.cs.txt in this folder are pointers, not alternate versions.
- Private fields use a leading
_followed by lower-camel case, for example_movementSpeed. - Every
constdeclaration usesALL_CAPS_WITH_UNDERSCORES, regardless of whether it is public, private, class-scoped, or local. Examples:MAXIMUM_RECENT_EVENTS,REPORT_ID, andLABEL_HEIGHT. Constants do not use the private-field_prefix. static readonlyfields are notconstdeclarations; name them according to the normal field convention unless the project explicitly defines otherwise.- Use PascalCase for public types, properties, events, and methods. Use camelCase for parameters and local variables.
- Keep the section separators and
#regionlayout consistent with the runtime template where those sections apply. - Keep
UpdateandFixedUpdatesmall. Put component resolution, module setup, and event subscriptions in their own initialization methods where needed. - Do not add empty lifecycle methods or initialization regions just to copy the template. Small helper/data classes should use only the sections they need.
- Keep comments technical and brief. Comments should explain intent or non-obvious behavior, not narrate the coding process.
- Use the editor template for initialization, cached serialized properties, drawing, cleanup, and helpers when the inspector needs them.
- Cache
SerializedPropertyreferences for custom serialized fields. - Pair
serializedObject.Update()andApplyModifiedProperties()when drawing serialized properties manually. - Use
Undofor direct object changes in Edit Mode and disable runtime-only test actions outside Play Mode. - Simple inspectors may call
DrawDefaultInspector()and add a small, focused control section without carrying unnecessary template boilerplate.
Source inspection and static checks are not a substitute for Unity compilation, Play Mode testing, or testing controller output on hardware. Record those results separately and do not imply tests passed unless they were run.