PromptFork

Generate a clean Unity C# character controller with the right architecture

Produces a maintainable Unity C# controller using proper component separation, the chosen input system, and inspector-tunable values — not a messy god-class in Update().

Open in Studio
Prompt
You are a senior Unity C# gameplay programmer who values clean, modular, inspector-tunable code.

Build a controller for: [DESCRIBE THE CHARACTER/AI AND WHAT IT MUST DO — e.g. 'a third-person platformer hero with run, jump, coyote time, and double jump'].

Constraints:
- Unity version: [2022 LTS / Unity 6].
- Input: [New Input System / legacy Input Manager].
- Physics: [Rigidbody / CharacterController].
- Architecture: split responsibilities — a CharacterStateMachine, a CharacterMotor for physics, and a PlayerInputReader. No god-class in Update().
- Expose every tunable (move speed, jump force, gravity scale, coyote time) as [SerializeField] private fields with [Header] grouping and sensible defaults.
- Use FixedUpdate for movement, clamp velocities, no magic numbers.
- Grounded detection tolerant of slopes up to [DEGREES].
- Include a clear extension point for new states (Dash, WallSlide).

Output:
1. A 3-bullet design rationale.
2. Each class as its own fenced code block, file name as a comment on line 1.
3. A wiring note: which GameObjects get which components and how the InputReader feeds the Motor.
4. A tuning-first checklist of values to tweak first in play mode.

State every physics/input assumption up front.

Success signal: the output is good only if responsibilities are split across the three classes, every tunable is serialized with a default, and the wiring note tells me exactly which components go on which GameObject.

Use case

Use when starting a new player or NPC controller and you want it modular and tunable instead of a wall of code in one method.

When to use this

For 3D/2D characters with the new Input System or legacy Input. State the physics setup (Rigidbody vs CharacterController).

Follow-up prompts

  • Add a Dash and WallSlide state using the same state-machine pattern.
  • Move tunables into a ScriptableObject preset so designers can swap feel profiles.
  • Port grounded detection to a SphereCast with proper slope handling.
#unity#csharp#game-dev#controller#gameplay-programming
Source
promptfork seed
License
CC-BY-4.0
Published
6/22/2026

More prompts you might like

Build a modular Unity enemy AI with a behavior tree or state machine

Produces a decoupled Unity C# enemy AI driven by a behavior tree or finite-state machine with reusable nodes, inspector-tunable decision weights, and clean extension points for new behaviors.

#unity#csharp
New

Build a Unity interactable-object system driven by events

Produces a decoupled interactable system — a reusable interface, a player interaction component, and UnityEvents or a scriptable-object event channel — so doors, levers, and pickups all plug in without hard references.

#unity#csharp
New
Editor’s pickGame DevelopmentSeed

Open-world (GTA-style) game build prompt

Scopes a 3D open-world prototype realistically — character controller + drivable vehicle + map first, bigger systems phased.

0001

Design + build a game: from design doc to playable prototype in one conversation

Starts with a structured game design document (core loop, Bartle motivation type, the one mechanic that makes it unique), then prototypes the core loop first with playtest checkpoints — not just 'make me a game.'

New

2D platformer with tuned physics, juice, and progressive level design

Goes beyond 'make a platformer' — specifies the exact physics values that make jumps feel great (coyote time, input buffering, variable gravity), the juice layer (screen shake, squash-stretch, particles), and the level design methodology that teaches mechanics through play.

New

Model a game economy's currency sinks and sources with a tuning sheet

Produces a sink/source balance model for an in-game currency — per-player generation vs spend, inflation risk, and a tuning spreadsheet you can rebalance without re-deriving the math each time.

#game-design#economy
New