A

Architect Unity Helper

Boost productivity using this expert, unity, game, developer. Includes structured workflows, validation checks, and reusable patterns for game development.

AgentClipticsgame developmentv1.0.0MIT
0 views0 copies

Unity Architect Helper

Your agent for Unity game development β€” covering C# scripting, component architecture, scene management, performance optimization, and Unity-specific design patterns.

When to Use This Agent

Choose Unity Architect Helper when:

  • Building games or applications in the Unity engine
  • Writing C# scripts for gameplay, UI, and system management
  • Designing Unity project architecture (managers, service locators, events)
  • Optimizing Unity performance (batching, pooling, profiling)
  • Implementing Unity-specific features (Addressables, Input System, Cinemachine)

Consider alternatives when:

  • You need Unreal Engine β€” use an Unreal Engine agent
  • You need Godot β€” use a Godot agent
  • You need web-based 3D (Three.js) β€” use a 3D Navigator agent

Quick Start

# .claude/agents/unity-architect.yml name: Unity Architect Helper model: claude-sonnet tools: - Read - Write - Edit - Bash - Glob - Grep description: Unity game development agent for C# scripting, component architecture, and engine optimization

Example invocation:

claude "Design an inventory system in Unity β€” scriptable object-based items, UI with drag-and-drop, save/load with JSON serialization, and event-driven updates"

Core Concepts

Unity Architecture Patterns

PatternPurposeExample
Singleton ManagerGlobal servicesAudioManager, GameManager
Service LocatorDependency accessServiceLocator.Get<IAudio>()
Scriptable ObjectsData containersItemData, EnemyConfig, DialogueData
Event SystemDecoupled communicationUnityEvent, C# events, ScriptableObject events
Object PoolingReuse objectsBulletPool, ParticlePool
State MachineCharacter statesPlayerStateMachine (Idle, Run, Jump)

Unity Project Structure

Assets/
β”œβ”€β”€ Scripts/
β”‚   β”œβ”€β”€ Core/              # Managers, singletons, utilities
β”‚   β”œβ”€β”€ Gameplay/           # Player, enemies, items
β”‚   β”œβ”€β”€ UI/                 # UI controllers, views
β”‚   β”œβ”€β”€ Data/               # Data models, serialization
β”‚   └── Editor/             # Custom editor scripts
β”œβ”€β”€ ScriptableObjects/      # SO asset definitions
β”œβ”€β”€ Prefabs/                # Reusable GameObjects
β”œβ”€β”€ Scenes/                 # Game scenes
β”œβ”€β”€ Materials/              # Materials and shaders
β”œβ”€β”€ Textures/               # Image assets
β”œβ”€β”€ Audio/                  # Sound effects and music
└── Plugins/                # Third-party libraries

Configuration

ParameterDescriptionDefault
unity_versionUnity version2023.x LTS
render_pipelineRender pipeline (built-in, urp, hdrp)urp
input_systemInput handling (old, new)new
target_platformBuild target (pc, mobile, console, webgl)pc
architectureCode architecture (simple, service-locator, di)service-locator

Best Practices

  1. Use ScriptableObjects for game data configuration. Items, enemy stats, dialogue, and ability definitions should be ScriptableObjects rather than hardcoded values. This separates data from logic, enables designer editing without code changes, and prevents data duplication.

  2. Avoid Find methods in Update loops. GameObject.Find(), FindObjectOfType(), and GetComponent() are expensive. Cache references in Awake() or Start() and reuse them. In hot loops, even GetComponent should be cached.

  3. Use the new Input System for cross-platform input. The new Input System supports multiple devices (keyboard, gamepad, touch) with a single action map. Define Input Actions as an asset, and bind them in code with InputAction.performed += callback.

  4. Implement object pooling for anything created at runtime. Bullets, particles, UI popups, and enemies should be pooled rather than instantiated/destroyed. Unity's ObjectPool<T> class provides a built-in pooling solution.

  5. Profile on target hardware, not just in the editor. The Unity Editor adds overhead that masks real performance characteristics. Build and profile on the target device (especially mobile) to identify actual bottlenecks.

Common Issues

Garbage collection causes frame rate spikes. Allocations in Update() (string concatenation, LINQ, foreach on collections) trigger GC. Use StringBuilder for strings, avoid LINQ in hot paths, and cache array/list allocations.

Scene loading causes long freezes. Use SceneManager.LoadSceneAsync() instead of synchronous loading. Show a loading screen and load scenes additively. For large scenes, split into smaller scenes loaded on demand.

Physics interactions are inconsistent between builds. Non-deterministic physics and floating-point differences cause issues. Move physics logic to FixedUpdate(), use Time.fixedDeltaTime, and avoid modifying physics objects in Update().

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates