Unity 6
Cursor rules for Unity 6
Unity 6 C# rules that refuse obsolete 2022 / UNet patterns. Input System defaults, current APIs, four files ready for Cursor, Claude, AGENTS.md, and Copilot.
Verified on 2026-10-15 · zip downloads · version-pinned
Verified for
- Unity 6.3 LTS (6000.3.x), APIs checked against 6000.6 docs on 2026-10-15
- Input System com.unity.inputsystem (Unity 6 new-project default)
Last tested 2026-10-15
Doc-verified only
doc-verified
The rules
Keeps agents off the calls Unity 6 removed or replaced: FindObjectOfType, Rigidbody.velocity, and the legacy Input Manager. Also stops the two Unity-specific footguns, deleting .meta files and running dotnet build.
Related fixes
Who it's for
People using an AI agent inside a Unity 6 (6000.x) project, including Unity MCP setups.
Install
Copy one file, or download the zip for that tool. The zip already uses the path below.
Cursor
.cursor/rules/unity-6.mdc
- Download the Cursor zip, or copy the .mdc file from this page.
- Save it as .cursor/rules/unity-6.mdc.
- Commit it. Cursor reads project rules from that folder.
Claude Code
CLAUDE.md
- Download the Claude zip, or copy CLAUDE.md.
- Put CLAUDE.md in the project root.
- Claude Code reads it as project memory on the next session.
AGENTS.md
AGENTS.md
- Download the Agents zip, or copy AGENTS.md.
- Put AGENTS.md in the project root.
- Agents that read AGENTS.md, including Codex and Cursor, pick it up there.
GitHub Copilot
.github/copilot-instructions.md
- Download the Copilot zip, or copy the instructions file.
- Save it as .github/copilot-instructions.md.
- Copilot reads repository instructions from that path.
Questions
- What does the Unity 6 pack do?
- Keeps agents off the calls Unity 6 removed or replaced: FindObjectOfType, Rigidbody.velocity, and the legacy Input Manager. Also stops the two Unity-specific footguns, deleting .meta files and running dotnet build.
- Who is the Unity 6 pack for?
- People using an AI agent inside a Unity 6 (6000.x) project, including Unity MCP setups.
- Which versions does the Unity 6 pack pin?
- Unity: 6.3 LTS (6000.3.x), APIs checked against 6000.6 docs on 2026-10-15 Input System: com.unity.inputsystem (Unity 6 new-project default) FindFirstObjectByType is valid on 6.0 but obsolete on 6.6. This pack tells the agent to use FindAnyObjectByType instead, which is valid on both. Last tested 2026-10-15.
- What does the first section of the Unity 6 pack say?
- Pinned to Unity 6.3 LTS (6000.3.x, supported through December 2027). The same calls are valid on the 6000.6 update line checked 2026-10-15, with one exception called out below. Do not emit Unity 2022 or earlier APIs. The first section, Project files, says: Never delete, rename, or hand-edit a `.meta` file. Unity stores the asset GUID there. Deleting one reimports the asset and breaks every reference to it. Do not run `dotnet build` to "check" a Unity project. The editor compiles assemblies itself. A bare `dotnet build` fails or compiles the wrong set of asmdefs. Edit scripts under `Assets/`. Do not write into `Library/`, `Temp/`, `Obj/`, or `Logs/`.
- When was the Unity 6 pack last tested, and how?
- Unity 6 was last tested on 2026-10-15. doc-verified.
Other free packs
Same four files, pinned to a different stack.
- AGENTS.md template for vibe coding
Vibe Coder Starter
Safe defaults for any AI coding agent in any stack. Tool-agnostic rules for Cursor, Claude Code, AGENTS.md, and Copilot so agents stay scoped and stop guessing.
- Next.js Supabase Cursor rules
Next.js + Supabase
Rules pinned to Next.js 16 and Supabase SSR — the APIs that actually work with React 19. Same advice in all four agent file formats, snippet-checked.
- Godot 4 CLAUDE.md
Godot 4
GDScript 2.0 rules that reject Godot 3 APIs. Written for Godot 4.x, parse-tested where it counts, shipped for every major AI coding tool.
Plain text
The same pack as markdown, plus each rules file on its own URL.
Files
.cursor/rules/unity-6.mdc
---
description: Unity 6.3 LTS C# rules. Input System, linearVelocity, no FindObjectOfType, never touch .meta files.
globs: "**/*.cs"
alwaysApply: false
---
# Unity 6 C# rules
Pinned to Unity 6.3 LTS (6000.3.x, supported through December 2027). The same calls are valid on the 6000.6 update line checked 2026-10-15, with one exception called out below. Do not emit Unity 2022 or earlier APIs.
## Project files
- Never delete, rename, or hand-edit a `.meta` file. Unity stores the asset GUID there. Deleting one reimports the asset and breaks every reference to it.
- Do not run `dotnet build` to "check" a Unity project. The editor compiles assemblies itself. A bare `dotnet build` fails or compiles the wrong set of asmdefs.
- Edit scripts under `Assets/`. Do not write into `Library/`, `Temp/`, `Obj/`, or `Logs/`.
## Finding objects
- `Object.FindObjectOfType` and `FindObjectsOfType` are obsolete. Do not use them.
- When any match is fine, use `Object.FindAnyObjectByType<T>()`. Do not call it from `Update` or `FixedUpdate`. Cache the result in `Awake` or `Start`.
- On Unity 6.6 and newer, `FindFirstObjectByType` is also obsolete, because it depended on InstanceID ordering. Do not use it. If you need a specific object, query with `FindObjectsByType<T>()` and sort by something real, such as sibling index.
- Prefer a serialized reference (`[SerializeField] private Player player;`) over any Find call.
## Input and physics
- Read input through the Input System package (`UnityEngine.InputSystem`). Do not call `Input.GetAxis`, `Input.GetKey`, or `Input.GetButton`. Those throw when the project is set to the new Input System only, which is the Unity 6 default for new projects.
- Read buttons in `Update`. Write to a Rigidbody in `FixedUpdate`.
- The velocity property is `Rigidbody.linearVelocity` (world space, units per second). `Rigidbody.velocity` does not exist in Unity 6. Do not assign `linearVelocity` every physics step. Use `AddForce` for ongoing motion and set `linearVelocity` only for an instant change such as a jump.
- Cache `GetComponent<Rigidbody>()` once. Do not call `GetComponent`, `Find`, or `Camera.main` inside `Update`.
```csharp
using UnityEngine;
using UnityEngine.InputSystem;
public class Jumper : MonoBehaviour
{
[SerializeField] private float jumpSpeed = 6f;
private Rigidbody body;
private bool jumpPressed;
private void Awake()
{
body = GetComponent<Rigidbody>();
}
private void Update()
{
jumpPressed = Keyboard.current != null && Keyboard.current.spaceKey.wasPressedThisFrame;
}
private void FixedUpdate()
{
if (!jumpPressed) return;
body.linearVelocity = new Vector3(body.linearVelocity.x, jumpSpeed, body.linearVelocity.z);
jumpPressed = false;
}
}
```
## Data and safety
- Expose designer fields with `[SerializeField] private`. Do not make gameplay fields public just so the Inspector can see them.
- Put tuneable numbers (damage, speeds, drop tables) on a ScriptableObject asset, not in a hardcoded constant inside a behaviour.
- Compare tags with `CompareTag("Player")`, not `tag == "Player"`.
- Null-check `Keyboard.current` and action references. They are null when the device is missing or the domain reloads.
## Async and timing
- For waits, prefer `Awaitable` (`await Awaitable.WaitForSecondsAsync(1f)`) or a coroutine. Do not use `Thread.Sleep` or `Task.Delay` on the main thread.
- Unity objects are not thread-safe. Touch `Transform`, `GameObject`, and components only on the main thread.
- Check `this != null` after an `await`. The object may have been destroyed while the method was suspended.
## Scenes and prefabs
- Do not write YAML into `.unity`, `.prefab`, or `.asset` files by hand. Change them in the editor or through an editor script.
- Load scenes by name or build index with `SceneManager.LoadSceneAsync`. Add the scene to the build profile first.
- Instantiate prefabs from a serialized reference, not `Resources.Load`, unless the project already uses Resources.
## Done checklist
1. The Console shows no compile errors after the editor recompiles.
2. No obsolete-API warnings were introduced (`FindObjectOfType`, `velocity`, `Input.*`).
3. You said whether Play Mode was actually tested.
Changelog
Placeholder. This is the first published cut, last verified on 2026-10-15. Version notes will replace this block when the pack is revised.