unity-performance

unity-performance is a cursor rule for Cursor from Bilal140202/the-lord-of-the-skills. It costs 2 tokens per session (1,227 once invoked), scanned A, a copy of unity-performance, MIT.

Performance guidance for Unity games, covering when recurring game-loop code should run and how reusable objects and assets should be managed.

In plain words
What is it for?
Use it to organize Update, FixedUpdate, and LateUpdate code, reuse frequently spawned objects, and load assets through Addressables.
Why use it?
It helps avoid unnecessary work every frame and reduces the cost of repeatedly creating and loading game objects.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use it to organize Update, FixedUpdate, and LateUpdate code, reuse frequently spawned objects, and load assets through Addressables.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/bilal140202/the-lord-of-the-skills/unity-performance
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Bilal140202/the-lord-of-the-skills

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for unity-performance

README.md
[![agentmods](https://agentmods.dev/badge/rules/bilal140202/the-lord-of-the-skills/unity-performance/github.svg)](https://agentmods.dev/rules/bilal140202/the-lord-of-the-skills/unity-performance)
Your own site
<a href="https://agentmods.dev/rules/bilal140202/the-lord-of-the-skills/unity-performance"><img src="https://agentmods.dev/badge/rules/bilal140202/the-lord-of-the-skills/unity-performance/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for unity-performance

Your own site · 80×15
<a href="https://agentmods.dev/rules/bilal140202/the-lord-of-the-skills/unity-performance"><img src="https://agentmods.dev/badge/rules/bilal140202/the-lord-of-the-skills/unity-performance.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,227 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00002 $0.01227
Opus 5 $0.00001 $0.00613
Sonnet 5 $0.00000 $0.00245
Haiku 4.5 $0.00000 $0.00123

Measured 9d ago against content hash dd51199f2138, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

unity-performance scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to unity-performance — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/gondor/cursor/Common-ka__ai-agent-unity-rules/unity-performance.mdc · 221 lines

How it starts

The opening of the file, as written. The whole thing — 221 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Unity Performance Rules

Update/FixedUpdate/LateUpdate

Usage Rules

using UnityEngine;

public class PerformanceExample : MonoBehaviour
{
    private Rigidbody _rigidbody;
    
    // ✅ DO: Cache components in Awake/Start
    private void Awake()
    {
        _rigidbody = GetComponent<Rigidbody>();
    }
    
    // ❌ DON'T: Frequent GetComponent calls in Update
    /* 
    private void Update()
    {
        GetComponent<Rigidbody>().AddForce(Vector3.up); // Bad! Expensive call every frame.
    }
    */
    
    private void FixedUpdate()
    {
        // ✅ DO: Physics calculations in FixedUpdate
        _rigidbody.AddForce(Vector3.up);
    }
    
    private void Update()
    {
        // ✅ DO: Input processing and frame-logic in Update
        ProcessInput();
    }
    
    private void LateUpdate()
    {
        // ✅ DO: Camera following logic in LateUpdate (after player moves)
        UpdateCameraPosition();
    }
    
    private void ProcessInput() { /* ... */ }
    private void UpdateCameraPosition() { /* ... */ }
}

Object Pooling (UnityEngine.Pool)

Unity 6.2 Note: Do not write custom Queue-based pools. Use the native UnityEngine.Pool API.

using UnityEngine;
using UnityEngine.Pool;

public class BulletManager : MonoBehaviour
{
    [SerializeField] private Bullet _bulletPrefab;
    
    // Native Unity Pool interface
    private IObjectPool<Bullet> _bulletPool;
    
    private void Awake()
    {
        // Initialize the pool
        _bulletPool = new ObjectPool<Bullet>(
            createFunc: CreateBullet,
            actionOnGet: OnGetBullet,
            actionOnRelease: OnReleaseBullet,
            actionOnDestroy: OnDestroyBullet,
            collectionCheck: true, // Checks for double-return errors (debug only)
            defaultCapacity: 50,
            maxSize: 100
        );
    }

    private Bullet CreateBullet()
    {
        Bullet bullet = Instantiate(_bulletPrefab, transform);
        bullet.SetPool(_bulletPool); // Inject pool reference into the bullet
        return bullet;
    }

    private void OnGetBullet(Bullet bullet) => bullet.gameObject.SetActive(true);
    private void OnReleaseBullet(Bullet bullet) => bullet.gameObject.SetActive(false);
    private void OnDestroyBullet(Bullet bullet) => Destroy(bullet.gameObject);
    
    public void FireBullet(Vector3 position, Vector3 direction)
    {
        Bullet bullet = _bulletPool.Get();
        bullet.transform.position = position;
        bullet.Fire(direction);
    }
}

public class Bullet : MonoBehaviour
{
    private IObjectPool<Bullet> _pool;

    public void SetPool(IObjectPool<Bullet> pool) => _pool = pool;

    public void Fire(Vector3 direction) { /* Physics logic */ }

    private void DisableSelf()
    {
        // ✅ DO: Return to pool instead of Destroy()
        _pool.Release(this);
    }
}

Read the full file on GitHub · 221 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 221 lines · 2 tokens per session scan A dd51199f2138

Subscribe to this mod's changes

unity-performance is a cursor rule published in the GitHub repository Bilal140202/the-lord-of-the-skills (4 stars, last pushed 6d ago), licensed MIT. It adds 2 tokens to every session and 1,227 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to unity-performance, differing in 0 lines, and is treated as a copy.