-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnaming-conventions.mdc
More file actions
20 lines (18 loc) · 894 Bytes
/
naming-conventions.mdc
File metadata and controls
20 lines (18 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
title: Unity naming conventions
description: Naming conventions for Unity C# code
globs: ["**/*.cs"]
alwaysApply: true
standards-version: 1.9.0
---
# Unity naming conventions
- PascalCase for: classes, structs, enums, methods, properties, public fields, constants
- camelCase for: local variables, parameters, private/protected fields
- Prefix private fields with underscore: _playerHealth, _moveSpeed
- Prefix interfaces with I: IInteractable, IDamageable
- Suffix MonoBehaviours descriptively: PlayerController, EnemySpawner, HealthDisplay
- Suffix ScriptableObjects with SO or Data: WeaponDataSO, LevelConfigData
- Suffix Editor scripts: PlayerControllerEditor, WeaponDataDrawer
- Boolean names should read as questions: isGrounded, hasKey, canJump
- Event names should use past tense: OnPlayerDied, OnItemCollected
- Avoid abbreviations except widely understood ones: hp, ui, id, fps