
Unity
- 13 installs
- 17 repo stars
- Updated February 16, 2026
- davincidreams/agent-team-plugins
Unity game engine patterns, MonoBehaviour lifecycle, best practices, and C# conventions.
About
Covers Unity engine patterns including lifecycle, project structure, and C# conventions. A developer uses it when building or structuring a Unity game project.
- Engine-file detection and Assets/Scripts project structure
- MonoBehaviour lifecycle and C# convention patterns
Unity by the numbers
- 13 all-time installs (skills.sh)
- Ranked #193 of 247 Game Development skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
npx skills add https://github.com/davincidreams/agent-team-plugins --skill unityAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 13 |
|---|---|
| repo stars | ★ 17 |
| Last updated | February 16, 2026 |
| Repository | davincidreams/agent-team-plugins ↗ |
What it does
Unity game engine patterns, MonoBehaviour lifecycle, best practices, and C# conventions.
Files
Unity Development Skill
Engine Detection
Look for: .csproj, .sln, .unity, .prefab, .asmdef, ProjectSettings/, Assets/, Packages/manifest.json
Project Structure
Assets/
Scripts/
Player/
Enemies/
UI/
Systems/
Utilities/
Prefabs/
Scenes/
Materials/
Textures/
Audio/
Animations/
ScriptableObjects/
Editor/ # Editor-only scripts
Plugins/ # Third-party plugins
Packages/
ProjectSettings/MonoBehaviour Lifecycle
Order of execution matters. Use the correct callback:
public class GameEntity : MonoBehaviour
{
// Called once when the script instance is loaded
void Awake()
{
// Initialize self-references (GetComponent, etc.)
// Do NOT reference other objects here - they may not be ready
}
// Called once before the first Update, after all Awake calls
void Start()
{
// Safe to reference other objects
// Initialize state that depends on other components
}
// Called every frame
void Update()
{
// Input handling, non-physics movement
// Use Time.deltaTime for frame-rate independence
}
// Called at fixed intervals (default 0.02s)
void FixedUpdate()
{
// Physics-related code (Rigidbody movement, forces)
}
// Called after all Update calls
void LateUpdate()
{
// Camera follow, UI updates that depend on game state
}
// Called when the object is destroyed
void OnDestroy()
{
// Unsubscribe events, clean up resources
}
void OnEnable() { /* Subscribe to events */ }
void OnDisable() { /* Unsubscribe from events */ }
}ScriptableObjects (Data-Driven Design)
Use ScriptableObjects for game data, configuration, and shared state:
[CreateAssetMenu(fileName = "NewWeapon", menuName = "Game/Weapon Data")]
public class WeaponData : ScriptableObject
{
public string weaponName;
public int damage;
public float attackSpeed;
public float range;
public GameObject projectilePrefab;
public AudioClip attackSound;
}Usage in components:
public class WeaponController : MonoBehaviour
{
[SerializeField] private WeaponData weaponData;
public void Attack()
{
// Use weaponData.damage, weaponData.attackSpeed, etc.
}
}Object Pooling
public class ObjectPool<T> where T : MonoBehaviour
{
private readonly Queue<T> pool = new();
private readonly T prefab;
private readonly Transform parent;
public ObjectPool(T prefab, int initialSize, Transform parent = null)
{
this.prefab = prefab;
this.parent = parent;
for (int i = 0; i < initialSize; i++)
pool.Enqueue(CreateInstance());
}
public T Get()
{
var obj = pool.Count > 0 ? pool.Dequeue() : CreateInstance();
obj.gameObject.SetActive(true);
return obj;
}
public void Return(T obj)
{
obj.gameObject.SetActive(false);
pool.Enqueue(obj);
}
private T CreateInstance()
{
var obj = Object.Instantiate(prefab, parent);
obj.gameObject.SetActive(false);
return obj;
}
}Event System
// ScriptableObject-based event channel
[CreateAssetMenu(menuName = "Events/Game Event")]
public class GameEvent : ScriptableObject
{
private readonly List<System.Action> listeners = new();
public void Raise() => listeners.ForEach(l => l.Invoke());
public void Register(System.Action listener) => listeners.Add(listener);
public void Unregister(System.Action listener) => listeners.Remove(listener);
}Key Rules
1. Never use Find/FindObjectOfType in Update - Cache references in Awake/Start 2. Use [SerializeField] over public fields - Encapsulation with inspector access 3. Use CompareTag() instead of == for tag comparison - Avoids GC allocation 4. Avoid string-based methods - Prefer direct references over SendMessage/Invoke 5. Use async/await or coroutines for async operations - Never block the main thread 6. Dispose resources in OnDestroy - Unsubscribe events, stop coroutines, release resources 7. Use Assembly Definitions (.asmdef) - Improve compile times in large projects 8. Use TextMeshPro over legacy UI Text - Better performance and rendering 9. Pool objects instead of Instantiate/Destroy - Reduce GC pressure 10. Use Addressables for asset loading - Better memory management than Resources.Load
Common Anti-Patterns
GetComponent<T>()every frame - cache itnew List<T>()in Update - allocates every framestring + stringin hot paths - use StringBuilderCamera.mainrepeated calls - cache the reference- Coroutines that never stop - always stop on disable/destroy
DOTS/ECS (Performance-Critical Systems)
For systems needing maximum performance, consider Unity's Data-Oriented Technology Stack:
- Use IComponentData for pure data components
- Use ISystem or SystemBase for processing logic
- Leverage Burst compiler for SIMD optimization
- Use NativeContainers for thread-safe collections
- Only use DOTS where performance demands it - MonoBehaviour is fine for most gameplay