๐ฎ Unity
๐ Table of Contentsโ
- ๐ฎ Unity
This framework is Unity-first and optimized for real-time interactive development: fast iteration, runtime performance, cross-platform builds, and scalable game architecture.
It combines 5W1H with Good Prompt principles
(Clear role ยท Clear format ยท Clear goal ยท Clear context ยท Clear constraints)
The key idea:
๐ The Unity project & runtime model are the source of truth
๐ User intent determines how deep engine-level optimizations go
๐๏ธ Context-ownedโ
These sections are owned by the prompt context.
They ensure correct, idiomatic, and engine-native guidance in Unity.
๐ค Who (Role / Persona)โ
Default Persona (Recommended)โ
- You are a senior Unity game developer / technical designer
- Think like a runtime-first engineer, not just a coder
- Assume real-time constraints and frame-based execution
- Optimize for performance, clarity, and iteration speed
Expected Expertiseโ
- Unity Editor & Play Mode lifecycle
- C# scripting & MonoBehaviour patterns
- Scene management & prefabs
- ScriptableObjects for data-driven design
- Physics, animation, and input systems
- Rendering pipelines (URP / HDRP / Built-in)
- Profiling (CPU, GPU, memory)
- Build settings & platform targets
- Asset import & optimization
- Version control (Git + LFS)
๐ ๏ธ How (Format / Constraints / Style)โ
๐ฆ Format / Outputโ
- Prefer:
- Unity-native concepts (Scenes, Prefabs, Components)
- Editor workflows over raw code when appropriate
- Explain:
- what Unity system is involved
- when it runs (Awake / Start / Update / FixedUpdate)
- Use:
- Clear diagrams or step flows
- Bullet points
- Tables for trade-offs (Editor vs Runtime)
โ๏ธ Constraints (Unity Best-Practice Rules)โ
- Respect the frame-based execution model
- Avoid heavy allocations in Update
- Prefer composition over inheritance
- Use ScriptableObjects for shared state & configs
- Avoid tight coupling between MonoBehaviours
- Optimize only after profiling
- Keep Editor-only code out of runtime builds
๐งฑ Scenes, Assets & Architectureโ
- Use Scenes to define runtime contexts
- Use Prefabs as reusable building blocks
- Separate:
- gameplay logic
- presentation (VFX, animation, audio)
- data/configuration
- Keep scene dependencies explicit
- Document non-obvious object lifecycles
โก Performance, Debugging & Iterationโ
- Heavy use of:
- Unity Profiler (CPU, GPU, GC)
- Frame Debugger
- Play Mode iteration
- Prefer:
- data-oriented thinking
- event-driven updates over polling
- Optimize for stable frame times
๐งช Builds, Platforms & Toolingโ
- Align Editor builds with CI pipelines
- Use build profiles per platform
- Keep quality settings deterministic
- Validate performance on target hardware
- Treat warnings and console errors seriously
๐ Explanation Styleโ
- Use Unity-specific terminology
- Explain:
- execution order implications
- editor-time vs runtime behavior
- performance costs per frame
- Avoid engine-agnostic advice unless required
โ๏ธ User-ownedโ
These sections must come from the user.
They define scope, platform targets, and acceptable optimization depth.
๐ What (Task / Action)โ
Examples:
- Implement a gameplay mechanic
- Fix a performance issue
- Refactor scene or prefab architecture
- Set up a build pipeline
- Optimize runtime memory usage
๐ฏ Why (Intent / Goal)โ
Examples:
- Achieve stable 60 FPS
- Reduce GC spikes
- Improve iteration speed
- Make gameplay systems scalable
- Ship on multiple platforms
๐ Where (Context / Situation)โ
Examples:
- Mobile game (iOS / Android)
- PC / Console project
- 2D platformer
- 3D action game
- AR / VR experience
โฐ When (Time / Phase / Lifecycle)โ
Examples:
- Prototype phase
- Vertical slice
- Performance optimization pass
- Pre-release polish
- Live-ops maintenance
๐ Final Prompt Template (Recommended Order)โ
1๏ธโฃ Persistent Context (Put in project docs or Assets/README.md)โ
# Unity Project Rules
You are working inside a Unity project with real-time constraints.
## Core Principles
- Respect the frame loop
- Optimize after profiling
- Prefer composition and data-driven design
## Architecture
- Use Prefabs and ScriptableObjects
- Keep scene dependencies explicit
## Performance
- Avoid per-frame allocations
- Measure before optimizing
## Safety
- Separate editor-only code
- Validate builds on target platforms
2๏ธโฃ User Prompt Templateโ
What I want to do:
[Describe the Unity feature or system.]
Why it matters:
[Performance, gameplay, iteration speed.]
Where this applies:
[Platform, genre, scene or system.]
(Optional)
When this is needed:
[Phase: prototype, optimization, release.]
(Optional)
โ Fully Filled Exampleโ
What I want to do:
Optimize a character controller causing frame drops.
Why it matters:
The game must maintain 60 FPS on mid-range mobile devices.
Where this applies:
A 3D mobile action game.
When this is needed:
During a performance optimization pass.
๐ง Why This Ordering Worksโ
- Runtime model first prevents incorrect assumptions
- Intent next guides optimization depth
- Scope last limits unintended side effects
Frames define truth.
The scene defines structure.
Context turns Unity into a scalable game engine.
Happy building with Unity ๐ฎ๐ ๏ธ