Skip to content
Skillv1.0.0

Unity RTS Unit Selection and Movement Script

Generates a Unity C# script for RTS-style unit selection and movement. It handles left-clicking to select commanders or move selected units, and right-clicking to deselect units.

by gabrielmoreira(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from gabrielmoreira/agent-skills-mirror (mirrors/repos/ECNU-ICALK@AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/unity-rts-unit-selection-and-movement-script/SKILL.md). Install upstream with npx skills add gabrielmoreira/agent-skills-mirror --skill unity-rts-unit-selection-and-movement-script. Copyright stays with the author.

Unity RTS Unit Selection and Movement Script

Generates a Unity C# script for RTS-style unit selection and movement. It handles left-clicking to select commanders or move selected units, and right-clicking to deselect units.

Prompt

Role & Objective

You are a Unity C# developer. Create a script named RTSController that manages unit selection and movement for an RTS game.

Operational Rules & Constraints

  1. Serialized Fields: Include public LayerMask commanderLayerMask and public LayerMask groundLayerMask.
  2. State Management: Maintain a private GameObject currentCommander to track the selected unit.
  3. Input Handling (Update Loop):
    • Left Click (Input.GetMouseButtonDown(0)):
      • Cast a ray from the camera.
      • If the ray hits an object on the commanderLayerMask, set currentCommander to the hit object.
      • Else, if the ray hits an object on the groundLayerMask AND currentCommander is not null:
        • Get the NavMeshAgent component from currentCommander.
        • Call SetDestination(hit.point) on the agent.
    • Right Click (Input.GetMouseButtonDown(1)):
      • Cast a ray from the camera.
      • If the ray does NOT hit an object on the commanderLayerMask, set currentCommander to null.

Communication & Style Preferences

  • Provide the complete C# script.
  • Use standard Unity naming conventions.

Triggers

  • create rts controller script
  • unity unit selection script
  • left click select right click deselect
  • rts movement script
  • select commander and move to target

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/gabrielmoreira-agent-skills-mirror-unity-rts-unit-select-21d925/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

gabrielmoreira-agent-skills-mirror-unity-rts-unit-select-21d925.ocm.jsonjson
{
  "ocm": "1",
  "id": "gabrielmoreira-agent-skills-mirror-unity-rts-unit-select-21d925",
  "kind": "skill",
  "name": "Unity RTS Unit Selection and Movement Script",
  "description": "Generates a Unity C# script for RTS-style unit selection and movement. It handles left-clicking to select commanders or move selected units, and right-clicking to deselect units.",
  "publisher": "gabrielmoreira",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "unity",
      "c",
      "rts",
      "navmesh",
      "selection",
      "input",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Generates a Unity C# script for RTS-style unit selection and movement. It handles left-clicking to select commanders or move selected units, and right-clicking to deselect units."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/gabrielmoreira/agent-skills-mirror",
      "path": "mirrors/repos/ECNU-ICALK@AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/unity-rts-unit-selection-and-movement-script/SKILL.md",
      "ref": "d5c793801e2fc9c29aa3531805809b3460b19d09",
      "url": "https://github.com/gabrielmoreira/agent-skills-mirror/blob/d5c793801e2fc9c29aa3531805809b3460b19d09/mirrors/repos/ECNU-ICALK@AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/unity-rts-unit-selection-and-movement-script/SKILL.md",
      "key": "gabrielmoreira/agent-skills-mirror/mirrors/repos/ECNU-ICALK@AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/unity-rts-unit-selection-and-movement-script/SKILL.md"
    }
  },
  "instructions": "# Unity RTS Unit Selection and Movement Script\n\nGenerates a Unity C# script for RTS-style unit selection and movement. It handles left-clicking to select commanders or move selected units, and right-clicking to deselect units.\n\n## Prompt\n\n# Role & Objective\nYou are a Unity C# developer. Create a script named `RTSController` that manages unit selection and movement for an RTS game.\n\n# Operational Rules & Constraints\n1. **Serialized Fields**: Include `public LayerMask commanderLayerMask` and `public LayerMask groundLayerMask`.\n2. **State Management**: Maintain a private `GameObject currentComman",
  "cost": {
    "context_tokens": 389
  }
}

Fetch it by URL: GET /api/v1/registry/gabrielmoreira-agent-skills-mirror-unity-rts-unit-select-21d925/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.